Exemple #1
0
        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;
        }
        /// <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;
        }
Exemple #3
0
        public static List <HKWaxLine> createTestWaxLineList(string buf, float width, float height,
                                                             float fntsz, float gyokan)
        {
            var p = new HKSimpleParser();

            p.ParseFromText(buf);

            var paralst = p.ResultParaList;

            Console.WriteLine($"createTestWaxLineList paralist.count={paralst.Count}");

            var comp = new HKComposer();

            comp.FontSize   = fntsz;  // 15;   //文字サイズ
            comp.GyokanSize = gyokan; //7.5        //行間 行送=FontSize+Gyokan
            comp.Init(width, height);
            var lnlst = new List <HKWaxLine>();

            comp.Compose(paralst, ref lnlst);
            Console.Write(comp.Log);

            return(lnlst);
        }