のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

Fonts

truetype F2Dot14 変換表

A 下位2Byteが、F2Dot14 A / 2^14 -32768 F8000 -2.000000 **** -32767 F8001 -1.999939 -32766 F8002 -1.999878 -16386 FBFFE -1.000122 -16385 FBFFF -1.000061 -16384 FC000 -1.000000 **** -16383 FC001 -0.999939 -16382 FC002 -0.999878 -2 FFFFE -0.0…

packed delta その6

カウントは1バイトまたは2バイトで格納されます。 第1のバイトを読み取った後、第2のバイトの必要性を判定することができる。 カウントバイトは次のように処理されます。最初のバイトが0の場合、2番目のカウントバイトは使用されません。 この値には特別な意…

packed delta その3

def test_compilePoints(self): compilePoints = lambda p: TupleVariation.compilePoints(set(p), numPointsInGlyph=999) self.assertEqual("00", hexencode(compilePoints(range(999)))) # all points in glyph self.assertEqual("01 00 07", hexencode(co…

packed delta その2

staticmethod def compilePoints(points, numPointsInGlyph): # If the set consists of all points in the glyph, it gets encoded with # a special encoding: a single zero byte. if len(points) == numPointsInGlyph: return b"\0"https://github.com/f…

packed delta

VariableFontのPackedDeltaを解析していて、先頭に、0x00があるときがある。 この意味がよくわからない。例 AdobeVFPrototype.ttfgvar - “.notdef” - tuple2 dump 0000A75A 0000A750 -- -- -- -- -- -- -- -- -- -- -- -- 00 80 0A EC 00 14 .##............…

ttx list

ttx -l AdobeVFPrototype.ttf Listing table info for "AdobeVFPrototype.ttf": tag checksum length offset ---- ---------- ------- ------- BASE 0x8B1E94B1 58 222680 DSIG 0x00000001 8 41692 GDEF 0x6A49F646 18285 204352 GPOS 0xD838104E 66034 1383…

"16.16" Fixed point

0x7AE1 /0x10000=31457/65536=0.4799957275390625 =0.480x3333/0x10000=13107/65536=0.1999969482421875=0.20x0003 3333 = 3.2 stackoverflow.com

stb_truetype

stb_truetype.h processing unicodepostd.cc

TypeSquareの文字を表示する。

はてなブログで、TypeSquare(Webフォント)を表示させる方法です。カスタマイズ>ヘッダ>タイトルしたへ、以下のようなスクリプトをコピー&ペーストする。 スクリプトは、TypeSquareのページで取得する。*1 <script type="text/javascript" src="//typesquare.com/accessor/script/typesquare.js?ABCD0123456789&fadein=10" charset="utf-8"></script> カスタマイズ>デザインCSSに以下のような設定…

CharMap

namespace SharpFont.Internal { [StructLayout(LayoutKind.Sequential)] internal class CharMapRec { internal IntPtr face; internal Encoding encoding; internal PlatformId platform_id; internal ushort encoding_id; } } namespace SharpFont { publ…

配列フィールドは ByValArray または SafeArray と組で使用してください。

LPArrayのところで、全て同じエラーになる。 LPArrayをByValArrayに変えると、動くようになる。 読みこむだけなら、これで問題なさそうに思える。 この感じの行があると、マーシャリングができないようだ。 [MarshalAs(UnmanagedType.LPArray, SizeConst = 4…

配列フィールドは ByValArray または SafeArray と組で使用してください。

> SharpFont.dll!SharpFont.PInvokeHelper.PtrToStructure<SharpFont.TrueType.Internal.HeaderRec>(System.IntPtr reference) 行 43 SharpFont.dll!SharpFont.TrueType.Header.Reference.set(System.IntPtr value) 行 205 SharpFont.dll!SharpFont.TrueType.Header.Header(System.IntPtr reference)</sharpfont.truetype.internal.headerrec>…

マーシャリングできません: 無効なマネージ/アンマネージ型の組み合わせです。

以下の試しのコードを実行したところ、マーシャリングのエラーになった。 namespace Examples { public partial class ExampleForm : Form { private void listBoxFont_SelectedIndexChanged(object sender, EventArgs e) { fontFace = new Face(lib, Path.C…

Faceクラス

namespace SharpFont { public sealed class Face : IDisposable { private IntPtr reference; private FaceRec rec; private Library parentLibrary; public Face(Library library, string path, int faceIndex) : this(library) { IntPtr reference; Error…

'System.TypeLoadException'

型 'System.TypeLoadException' のハンドルされていない例外が mscorlib.dll で発生しました 追加情報:型 'SharpFont.TrueType.Internal.HeaderRec' の フィールド 'Created' をマーシャリングできません: 無効なマネージ/アンマネージ型の組み合わせです。 …

GetSfntTable

public object GetSfntTable(SfntTag tag) { IntPtr tableRef = FT.FT_Get_Sfnt_Table(Reference, tag); if (tableRef == IntPtr.Zero) return null; switch (tag) { case SfntTag.Header: return new Header(tableRef); case SfntTag.HorizontalHeader: ret…

composite glyph

1655 /* otherwise, load a composite! */ 1656 else if ( loader->n_contours == -1 ) 1657 { 1658 FT_UInt start_point; 1659 FT_UInt start_contour; 1660 FT_ULong ins_pos; /* position of composite instructions, if any */ 1661 1662 1663 start_poi…

FT_DEFINE_SFNT_INTERFACE

565 #ifndef FT_CONFIG_OPTION_PIC 566 567 #define FT_DEFINE_SFNT_INTERFACE( \ 568 class_, \ 569 goto_table_, \ 570 init_face_, \ 571 load_face_, \ 572 done_face_, \ 573 get_interface_, \ 574 load_any_, \ 575 load_head_, \ 576 load_hhea_, \ …

ebdt

460 FT_DEFINE_SFNT_INTERFACE( 461 sfnt_interface, 462 tt_face_goto_table, 463 464 sfnt_init_face, 465 sfnt_load_face, 466 sfnt_done_face, 467 sfnt_get_interface, 468 469 tt_face_load_any, 470 471 tt_face_load_head, 472 tt_face_load_hhea, 4…

ebdt

static void ShowGlyph(FILE *ttf,long offset,long len,int imageFormat, struct ttfinfo *info) { int h,w,sbX,sbY,advance; int i,j,k,ch; long here; if ( imageFormat!=1 && imageFormat!=2 ) return; here = ftell(ttf); fseek(ttf,info->bitmapdata_s…

showttf

fontforge/contrib/fonttools/showttf.c

ttx -t EBDT -z bitwise

$ ttx -t EBDT -z bitwise MS-Gothic.ttf Dumping "MS-Gothic.ttf" to "MS-Gothic#7.ttx"... Dumping 'EBDT' table... Traceback (most recent call last): File "/Users/m_fujii/bin/FDK/Tools/osx/../SharedData/FDKScripts/ttx.py", line 13, in <module> ttx.mai</module>…

ttx -t EBDT -z row

$ ttx -t EBDT -z row MS-Gothic.ttf Dumping "MS-Gothic.ttf" to "MS-Gothic#5.ttx"... Dumping 'EBDT' table... Traceback (most recent call last): File "/Users/m_fujii/bin/FDK/Tools/osx/../SharedData/FDKScripts/ttx.py", line 13, in <module> ttx.main(sy</module>…

ttx EBDT

$ ttx -t EBDT -z raw MS-Gothic.ttf Dumping "MS-Gothic.ttf" to "MS-Gothic#2.ttx"... Dumping 'EBDT' table... $ vi MS-Gothic#2.ttx <ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="2.5"> <EBDT> <header version="2.0"/> <strikedata index="0"> </strikedata></header></ebdt></ttfont>

otc2otf

$ otc2otf msgothic.ttc Input font: msgothic.ttc Output font: MS-Gothic.ttf Output font: MS-UIGothic.ttf Output font: MS-PGothic.ttf Done$ ttx MS-Gothic.ttf Dumping "MS-Gothic.ttf" to "MS-Gothic.ttx"... Dumping 'GlyphOrder' table... Dumping…

truetype cmap format 4

<cmap> <tableVersion version="0"/> <cmap_format_4 platformID="0" platEncID="3" language="0"> <map code="0x20" name="uni00A0"/> <map code="0x21" name="exclam"/> <map code="0x22" name="quotedbl"/> <map code="0x23" name="numbersign"/></map></map></map></map></cmap_format_4></tableversion></cmap>

truetype cmap format 2

/** * Read a format 2 subtable. * * @param data the data stream of the to be parsed ttf font * @param numGlyphs number of glyphs to be read * @throws IOException If there is an error parsing the true type font. */ protected void processSub…

TrueType OpenType ファイル構造 その1

$ xxd arial.ttf | head 00000000: 0001 0000 0019 0100 0004 0090 4453 4947 ............DSIG 00000010: b77e 536a 000d dc30 0000 1adc 4744 4546 .~Sj...0....GDEF 00000020: b13f b3a1 000c 4b24 0000 0334 4750 4f53 .?....K$...4GPOS 00000030: 83c6 …

ARG_1_AND_2_ARE_WORDS

if ($flags & self::ARG_1_AND_2_ARE_WORDS) { if ($flags & self::ARGS_ARE_XY_VALUES) { $e = $font->readInt16(); $f = $font->readInt16(); } else { $point_compound = $font->readUInt16(); $point_component = $font->readUInt16(); } } else { if ($…

spot

spot -tGSUB=7 KozGoKanaNK-Heavy.otf$ spot -h Usage: spot [-u|-h|-ht|-r] [-n|-nc|-G|-T|-F] [-f] [-V] [-m] [-d][-i<ids>] [-o<offs>] [-t<tags>|-P<featuretags>] [-p<policy>] [-@ <ptsize>] <fontfile>+ OR: spot -X <scriptfile> Options: -u print usage information -h print usage and help information -ht pri…</scriptfile></fontfile></ptsize></policy></featuretags></tags></offs></ids>