のねのBlog

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

glyph composite

glyf - Glyf Data

This table contains information that describes the glyphs in the font in the TrueType outline format. Information regarding the rasterizer (scaler) refers to the TrueType rasterizer.
Each glyph begins with the following header:
Type	Name	Description
SHORT	numberOfContours	If the number of contours is greater than or equal to zero, this is a single glyph; 
if negative, this is a composite glyph. <======

SHORT	xMin	Minimum x for coordinate data.
SHORT	yMin	Minimum y for coordinate data.
SHORT	xMax	Maximum x for coordinate data.
SHORT	yMax	Maximum y for coordinate data.
Note that the bounding rectangle from each character is defined as the rectangle with a lower left corner of (xMin, yMin) and an upper right corner of (xMax, yMax).
Note: The scaler will perform better if the glyph coordinates have been created such that the xMin is equal to the lsb. For example, if the lsb is 123, then xMin for the glyph should be 123. If the lsb is -12 then the xMin should be -12. If the lsb is 0 then xMin is 0. If all glyphs are done like this, set bit 1 of flags field in the &#39;head&#39; table.
Composite Glyph Description

This is the table information needed for composite glyphs (numberOfContours is -1). A composite glyph starts with two USHORT values (???flags??? and ???glyphIndex,??? i.e. the index of the first contour in this composite glyph); the data then varies according to ???flags???).
Type	Name	Description
USHORT	flags	component flag
USHORT	glyphIndex	glyph index of component
VARIABLE	argument1	x-offset for component or point number; type depends on bits 0 and 1 in component flags
VARIABLE	argument2	y-offset for component or point number; type depends on bits 0 and 1 in component flags
Transformation Option
The C pseudo-code fragment below shows how the composite glyph information is stored and parsed; definitions for ???flags??? bits follow this fragment: