Example #1
0
        private DPixelFont.CharItem HanzToPixel(HanzFontItem hanzItem)
        {
            DPixelFont.CharItem ret = new DPixelFont.CharItem();
            ret.Code = hanzItem.code;
            if (hanzItem.code < 128)
            {
                if (hanzItem.code - 0x20 <= AscFontSize.Length)
                {
                    ret.CharWidth = (ushort)AscFontSize[hanzItem.code - 0x20].Width;
                }
                else
                {
                    ret.CharWidth = AscWidth;
                }
                ret.Data = new byte[(ret.CharWidth + 7) / 8 * CharLines];
                for (int i = 0; i < CharLines; i++)
                {
                    int pixelStart = (ret.CharWidth + 7) / 8 * i;
                    int hanzStart  = (MapWidth + 7) / 8 * i;

                    for (int j = 0; j < ret.CharWidth; j = j + 8)
                    {
                        ret.Data[pixelStart + j / 8] = copyLeftBit(hanzItem.array[hanzStart + j / 8], ret.CharWidth - j);
                    }
                }
            }
            else
            {
                ret.CharWidth = this.MapWidth;
                ret.Data      = hanzItem.array;
            }

            return(ret);
        }
Example #2
0
        public DPixelFont ToPixelFont()
        {
            DPixelFont pf = new DPixelFont();

            pf.FontName   = "HanzFont";
            pf.FontHeight = this.CharLines;
            pf.MapHeight  = this.CharLines;
            pf.MapWidth   = this.MapWidth;
            pf.CharArray  = new DPixelFont.CharItem[this.FontArray.Length];
            for (int i = 0; i < pf.CharArray.Length; i++)
            {
                DPixelFont.CharItem item = HanzToPixel(FontArray[i]);
                pf.CharArray[i] = item;
            }

            return(pf);
        }
Example #3
0
        public DPixelFont ToPixelFont()
        {
            DPixelFont pf = new DPixelFont();

            pf.FontName   = "CXFontInfo";
            pf.MapHeight  = this.height;
            pf.FontHeight = this.height;
            pf.MapWidth   = this.height;
            pf.CharArray  = new DPixelFont.CharItem[this.size];
            for (int i = 0; i < pf.CharArray.Length; i++)
            {
                DPixelFont.CharItem item = new DPixelFont.CharItem();
                item.Code       = array[i].code;
                item.Data       = array[i].array;
                item.CharWidth  = array[i].width;
                pf.CharArray[i] = item;
            }

            return(pf);
        }