public void Compose() { //if (_paralst?.Count == 0 ) return; if (isValid() != true) { return; } int devw = _tateviewWidth; int devh = _tateviewHeight; //1.Compose float fntSz = 24; if (_isFontSizeLarge == true) { fntSz += 24; } //float gyokanSz = fntSz * 0.5f; float gyokanSz = fntSz * 1.0f; if (_isVisibleHinshi == true) { gyokanSz += fntSz * 1.0f; } float mg = 10; //デバイスに対しての余白 HKComposer comp = new HKComposer(); comp.FontSize = fntSz; comp.GyokanSize = gyokanSz; comp.Init((float)devw - mg * 2, (float)devh - mg * 2); _lnlst.Clear(); comp.Compose(_paralst, ref _lnlst); //2.Page一覧 _pglst.Clear(); HKPageCreate.CreatePageList((float)devw - mg * 2, fntSz, _lnlst, ref _pglst); //3.Deviceの値に変換 HKDevice dev = new HKDevice(); dev.setup(fntSz, (float)devw, (float)devh, mg, mg, mg, mg); dev.calcToDevice(ref _pglst); CurrentPage = _pglst[0]; PageNum = _pglst.Count; }
public static IList <IHKWaxPage> createTestCalcDevice(string buf, float fntsz, float gyokan, float view_w, float view_h, float mg_lft, float mg_rgt, float mg_top) { List <HKWaxLine> lnlst = WaxComposerTest.createTestWaxLineList(buf, view_w, view_h, fntsz, gyokan); //HKPageCreate page = new HKPageCreate(); IList <IHKWaxPage> pglst = new List <IHKWaxPage>(); HKPageCreate.CreatePageList(view_w, fntsz, lnlst, ref pglst); HKDevice dev = new HKDevice(); dev.setup(fntsz, view_w + mg_lft + mg_rgt, view_h, mg_lft, mg_top, mg_rgt, 0); dev.calcToDevice(ref pglst); return(pglst); }
/// <summary> /// ページを組版 /// </summary> public void Compose(bool isForce = false) { if (isForce != true && IsValid() != true) { return; } PageIndex = 0; double devw = TateviewWidth; double devh = TateviewHeight; //1.Compose float fntSz = FontSize; if (IsFontSizeLarge == true) { fntSz += 24; } //float gyokanSz = fntSz * 0.5f; float gyokanSz = fntSz * 1.0f; float mg = 10; //デバイスに対しての余白 HKComposer comp = new HKComposer(); comp.FontSize = fntSz; comp.GyokanSize = gyokanSz; comp.Init((float)devw - mg * 2, (float)devh - mg * 2); _lnlst.Clear(); comp.Compose(_paralst, ref _lnlst); //2.Page一覧 PageList.Clear(); var pglst = PageList; HKPageCreate.CreatePageList((float)devw - mg * 2, fntSz, _lnlst, ref pglst); //3.Deviceの値に変換 HKDevice dev = new HKDevice(); dev.setup(fntSz, (float)devw, (float)devh, mg, mg, mg, mg); dev.calcToDevice(ref pglst); PageNum = PageList.Count; }
public void CreatePageList() { var buf = "<p>あああああ<ruby>い" + "いいいい<rt>ううう</rt></ruby>ええ" + "えええ</p>" + "<p>おおおおお</p>" + "<p>あああああ<ruby>いいいいい<rt>ううう</rt></ruby>えええええ</p>" + "<p>おおおおお</p>" + "<p>あああああ<ruby>いいいいい<rt>ううう</rt></ruby>えええええ</p>" + "<p>おおおおお</p>" + "<p>あああああ<ruby>いいいいい<rt>ううう</rt></ruby>えええええ</p>" + "<p>おおおおお</p>" + "<p>あああああ<ruby>いいいいい<rt>ううう</rt></ruby>えええええ</p>" + "<p>おおおおお</p>" ; float view_w = 90; float view_h = 90; //余白を除いた描画領域 ==> 6文字/1行 float fntsz = 15; float gyokan = 6f; //15 + 21+21+21 ==> 4行/ページ List <HKWaxLine> lnlst = WaxComposerTest.createTestWaxLineList(buf, view_w, view_h, fntsz, gyokan); //HKPageCreate rep = new HKPageCreate(); var pglst = new List <IHKWaxPage>(); HKPageCreate.CreatePageList(view_w, fntsz, lnlst, ref pglst); //Assert.AreEqual(4, pglst.Count); Assert.AreEqual(4, pglst[0].Lines.Count, "1ページ目行数"); Assert.AreEqual(0, pglst[0].Lines[0].X); Assert.AreEqual("あああああい", pglst[0].Lines[0].getText(), "1ページ目1行目"); Assert.AreEqual(fntsz + gyokan, pglst[0].Lines[1].PageX); Assert.AreEqual("いいいいええ", pglst[0].Lines[1].getText()); Assert.AreEqual("えええ", pglst[0].Lines[2].getText()); Assert.AreEqual("おおおおお", pglst[0].Lines[3].getText()); Assert.AreEqual(0, pglst[1].Lines[0].PageX, "2ページ目の1文字目X"); //DAME!! Assert.AreEqual("あああああい", pglst[1].Lines[0].getText(), "2ページ目1行目"); //最終頁最終行 Assert.AreEqual("おおおおお", pglst.Last().Lines.Last().getText()); }