public eblcSizeTreeNode(TTFFile file, TableDirectoryEntry entry, bitmapSizeTable size) : base(size.ppemX.ToString() + "×" + size.ppemY.ToString()) { this.file = file; this.entry = entry; this.size = size; }
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; } }
public eblcGlyphList(TTFFile file, bitmapSizeTable size) { this.file = file; this.entry = file.tables["EBLC"]; this.size = size; this.InitComponents(); }
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)); } }
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); } } } }
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); } } } }
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++; } } }
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(); } }
public headTreeNode(TTFFile file, TableDirectoryEntry entry) : base(file, entry) { }
public ttffileTreeNode(TTFFile file) : base(file.FileName + " (場所 " + file.DirectoryName + ")") { this.file = file; this.Nodes.Add("null"); }
public eblcTreeNode(TTFFile file, TableDirectoryEntry entry) : base(file, entry) { this.Nodes.Add("null"); }
public eblcSizeControl(TTFFile file, TableDirectoryEntry entry, bitmapSizeTable size) : this() { this.SetStrike(file, entry, size); }
internal TableTreeNode(TTFFile file, TableDirectoryEntry entry) : base(entry.TagName) { this.file = file; this.entry = entry; }