예제 #1
0
 public eblcSizeTreeNode(TTFFile file, TableDirectoryEntry entry, bitmapSizeTable size)
     : base(size.ppemX.ToString() + "×" + size.ppemY.ToString())
 {
     this.file  = file;
     this.entry = entry;
     this.size  = size;
 }
예제 #2
0
        private void menuItem2_Click(object sender, EventArgs e)
        {
            if (this.openFileDialog1.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            string fname = this.openFileDialog1.FileName;

            switch (System.IO.Path.GetExtension(fname).ToLower())
            {
            case ".ttf":
                TTFFile file = new TTFFile(fname);
                if (!file.Read())
                {
                    return;
                }
                this.treeView1.Nodes.Add(new TTF.ttffileTreeNode(file));
                break;

            case ".mp3":
                afh.File.MP3.MP3File mp3 = new afh.File.MP3.MP3File(fname);
                this.treeView1.Nodes.Add(new FontEditor.mp3fileTreeNode(mp3));
                break;

            default:
                System.Windows.Forms.MessageBox.Show("このファイル形式には対応していません");
                break;
            }
        }
예제 #3
0
 public eblcGlyphList(TTFFile file, bitmapSizeTable size)
 {
     this.file  = file;
     this.entry = file.tables["EBLC"];
     this.size  = size;
     this.InitComponents();
 }
예제 #4
0
        public static TableTreeNode CreateTreeNode(TTFFile file, TableDirectoryEntry entry)
        {
            switch (entry.TagName)
            {
            case "EBLC": return(new eblcTreeNode(file, entry));

            case "head": return(new headTreeNode(file, entry));

            default:
                return(new TableTreeNode(file, entry));
            }
        }
예제 #5
0
        static void MeasureStringMeasurer(TTFFile file)
        {
            var measurer = Scryber.OpenType.TTF.TTFStringMeasurer.Create(file, CMapEncoding.WindowsUnicode, TypeMeasureOptions.Default);

            for (var repeat = 0; repeat < maxRepeat; repeat++)
            {
                for (var index = 0; index < AllToMeasure.Length; index++)
                {
                    var str = AllToMeasure[index];
                    int fitted;
                    var size = measurer.MeasureChars(str, 0, 12.0, 5061, false, out fitted);

                    if (fitted != AllFitted[index])
                    {
                        throw new InvalidOperationException("The measured number of characters " + fitted + " was not the same as the expected result " + AllFitted[index] + " for string " + index);
                    }
                }
            }
        }
예제 #6
0
        static void MeasureStringsUsual(TTFFile file)
        {
            for (var repeat = 0; repeat < maxRepeat; repeat++)
            {
                for (var index = 0; index < AllToMeasure.Length; index++)
                {
                    var str = AllToMeasure[index];
                    int fitted;
                    var encoding = CMapEncoding.WindowsUnicode;
                    var size     = file.MeasureString(encoding, str, 0, 12.0, 5061, false, out fitted);


                    if (fitted != AllFitted[index])
                    {
                        throw new InvalidOperationException("The measured number of characters " + fitted + " was not the same as the expected result " + AllFitted[index] + " for string " + index);
                    }
                }
            }
        }
예제 #7
0
        public unsafe void SetStrike(TTFFile file, TableDirectoryEntry entry, bitmapSizeTable size)
        {
            this.file  = file;
            this.entry = entry;
            this.size  = size;
            this.horiLineMetrics.SetLineMetrics(size.hori);
            this.vertLineMetrics.SetLineMetrics(size.vert);

            // set text to labels
            this.lStartGlyphIndex.Text  = "0x" + ((uint)this.size.startGlyphIndex).ToString("X4");
            this.lEndGlyphIndex.Text    = "0x" + ((uint)this.size.endGlyphIndex).ToString("X4");
            this.lPpemX.Text            = this.size.ppemX.ToString();
            this.lPpemY.Text            = this.size.ppemY.ToString();
            this.lBitDepth.Text         = this.size.bitDepth.ToString();
            this.lColorRef.Text         = "0x" + ((uint)this.size.colorRef).ToString("X8");
            this.pictColorRef.BackColor = System.Drawing.Color.FromArgb((int)(uint)this.size.colorRef);
            this.chkHoriLayout.Checked  = this.size.HorizontalLayout;
            this.chkVertLayout.Checked  = this.size.VerticalLayout;

            // indexSubTableArray
            this.listView1.Items.Clear();
            fixed(byte *pImg = &this.file.image[0])
            {
                indexSubTableArray *subtableAB = (indexSubTableArray *)(pImg + (uint)entry.offset + (uint)size.indexSubTableArrayOffset);
                indexSubTableArray *subtableAM = subtableAB + (uint)size.numberOfIndexSubTables;
                indexSubTableArray *subtableA  = subtableAB;
                indexSubHeader *    subheader;

                while (subtableA < subtableAM)
                {
                    subheader = (indexSubHeader *)((byte *)subtableAB + (uint)subtableA->additionalOffsetToIndexSubTable);

                    string[] items = new string[] {
                        string.Format("{0:X4} - {1:X4}", (ushort)subtableA->firstGlyphIndex, (ushort)subtableA->lastGlyphIndex)
                        , subheader->IndexFormatString
                        , subheader->ImageFormatString
                        , subheader->NumberOfGlyph(*subtableA).ToString()
                    };
                    this.listView1.Items.Add(new System.Windows.Forms.ListViewItem(items));
                    subtableA++;
                }
            }
        }
예제 #8
0
        private unsafe void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Text != "EBLC")
            {
                return;
            }
            if (e.Node.Parent != null && e.Node.Parent.Tag is TTFFile)
            {
                TTFFile             file  = (TTFFile)e.Node.Parent.Tag;
                TableDirectoryEntry entry = file.tables["EBLC"];
                Program.ErrorOut.WriteLine("EBLC 表を読みます。");
                Program.ErrorOut.AddIndent();
                fixed(byte *pBase = &file.image[0])
                {
                    byte *p = pBase;

                    p += (uint)entry.offset;

                    //-- header
                    eblcHeader *header = (eblcHeader *)p;
                    uint        nSize  = (uint)header->numSizes;

                    Program.ErrorOut.WriteLine("表バージョン番号: {0}", header->version.Value);
                    Program.ErrorOut.WriteLine("strike の数: {0}", nSize);
                    p += sizeof(eblcHeader);

                    //-- bitmapSizeTables
                    bitmapSizeTable *size  = (bitmapSizeTable *)p;
                    bitmapSizeTable *sizeM = size + nSize;

                    while (size < sizeM)
                    {
                        Program.ErrorOut.WriteLine("Size {{ppemX:{0} ; ppemY: {1}}}", size->ppemX, size->ppemY);
                        size++;
                    }
                }

                Program.ErrorOut.RemoveIndent();
            }
        }
예제 #9
0
 public headTreeNode(TTFFile file, TableDirectoryEntry entry) : base(file, entry)
 {
 }
예제 #10
0
 public ttffileTreeNode(TTFFile file) : base(file.FileName + " (場所 " + file.DirectoryName + ")")
 {
     this.file = file;
     this.Nodes.Add("null");
 }
예제 #11
0
 public eblcTreeNode(TTFFile file, TableDirectoryEntry entry) : base(file, entry)
 {
     this.Nodes.Add("null");
 }
예제 #12
0
 public eblcSizeControl(TTFFile file, TableDirectoryEntry entry, bitmapSizeTable size) : this()
 {
     this.SetStrike(file, entry, size);
 }
예제 #13
0
 internal TableTreeNode(TTFFile file, TableDirectoryEntry entry) : base(entry.TagName)
 {
     this.file  = file;
     this.entry = entry;
 }