### Example: Using LOOPCALL (TrueType Assembly) Source: https://learn.microsoft.com/en-us/typography/opentype/otspec183/tt_instructions An example demonstrating the usage of FDEF, ENDF, PUSHB, and LOOPCALL to define and execute a function multiple times. ```TrueType Assembly PUSHB(000), 17| push 17 onto the stack FDEF[ ]| start defining function 17 ...| contents of function ...| ENDF[ ]| end the definition PUSHB(000),5| push count PUSHB(000),17| push function number LOOPCALL[ ]| call function 17, 5 times ``` -------------------------------- ### BASE Header Table Example Source: https://learn.microsoft.com/en-us/typography/opentype/otspec170/base An example illustrating the BASE Header table, including offsets to Horizontal and Vertical Axis tables, and version information. ```APIDOC ## BASE Header Table Example ### Description This example shows the BASE Header table, which contains version information and offsets to the HorizontalAxisTable and VerticalAxisTable. ### Endpoint N/A (This is a data structure definition) ### Parameters #### Request Body - **Version** (uint32) - Required - The version of the BASE table (e.g., 0x00010000). - **HorizontalAxisTable** (Offset) - Required - Offset to the Horizontal Axis table. - **VerticalAxisTable** (Offset) - Required - Offset to the Vertical Axis table. ### Request Example ```json { "Version": "0x00010000", "HorizontalAxisTable": "0x0008", "VerticalAxisTable": "0x010C" } ``` ### Response #### Success Response (200) - **BASEHeader** (object) - Contains the BASE table header details. - **Version** (uint32) - The version of the BASE table. - **HorizontalAxisTable** (Offset) - Offset to the Horizontal Axis table. - **VerticalAxisTable** (Offset) - Offset to the Vertical Axis table. #### Response Example ```json { "BASEHeader": { "Version": "0x00010000", "HorizontalAxisTable": "0x0008", "VerticalAxisTable": "0x010C" } } ``` ``` -------------------------------- ### Example 1: BASE Table Structure Source: https://learn.microsoft.com/en-us/typography/opentype/otspec160/base Illustrates a sample BASE table containing header, axis, script list, and tag list information for multiple scripts. ```APIDOC ## BASE Table Example 1 ### Description This example describes a sample font that contains four scripts: Cyrillic, Devanagari, Han, and Latin. All four scripts are rendered horizontally; only one script, Han, is rendered vertically. The BASE header gives offsets to two Axis tables: HorizAxis and VertAxis. This example shows data defined in the HorizAxis table. ### Table Breakdown **BASEHeader** - Version: 0x00010000 - Offset to HorizAxis table: 0x0008 - Offset to VertAxis table: 0x010C **HorizontalAxisTable** - Offset to BaseTagList table: 0x0004 - Offset to BaseScriptList table: 0x0012 **BaseTagList (HorizBaseTagList)** - BaseTagCount: 3 - BaselineTag[0]: "hang" - BaselineTag[1]: "ideo" - BaselineTag[2]: "romn" **BaseScriptList (HorizBaseScriptList)** - BaseScriptCount: 4 - BaseScriptRecord[0] (cyrl): - BaseScriptTag: "cyrl" - Offset to BaseScript table: 0x001A - BaseScriptRecord[1] (devn): - BaseScriptTag: "devn" - Offset to BaseScript table: 0x0060 - BaseScriptRecord[2] (hani): - BaseScriptTag: "hani" - Offset to BaseScript table: 0x008A - BaseScriptRecord[3] (latn): - BaseScriptTag: "latn" - Offset to BaseScript table: 0x00B4 ``` -------------------------------- ### Control Program Setup for Italic Run and Rise CVTs Source: https://learn.microsoft.com/en-us/typography/truetype/italic-hinting-examples This code sets up the control program, including the definition of CVT values for ItalicRun and ItalicRise. It also includes basic instruction control and CVT cut-in settings. ```VTTTalk InstructionsOn @8..2047 DropOutCtrlOff @144 CvtCutIn = 4, 2.5@29, 0@128 /* Heights */ UpperCase Grey Y SquareHeight 2: 1466 8: 0 /* Glyph Stroke Angle */ UpperCase Grey X ItalicRun 20: 307 Y ItalicRise 21: 1466 /* Strokes */ UpperCase Black Y StraightStroke 72: 166 Diag StraightStroke 76: 191 ``` -------------------------------- ### rcurveline Source: https://learn.microsoft.com/en-us/typography/opentype/otspec181/cff2charstr Appends one or more Bézier curves to the current point. The curve starts horizontal and ends vertical, or alternates between start horizontal/end vertical and start vertical/end horizontal. ```APIDOC ## rcurveline ### Description Appends one or more Bézier curves to the current point. The tangent for the first Bézier must be horizontal, and the second must be vertical. Curves alternate between start horizontal/end vertical, and start vertical/end horizontal. The last curve need not end horizontal/vertical. ### Method N/A (Command within a larger drawing instruction) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ``` |- {dxa dya dxb dyb dxc dyc}+ dxd dyd **rcurveline** (24) |- ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Coordinate Instruction Source: https://learn.microsoft.com/en-us/typography/opentype/otspec150/tt_instructions Gets the coordinate of a point projected onto the projection vector. ```APIDOC ## Get Coordinate projected onto the projection_vector ### Description Measures the coordinate value of point p on the current projection_vector and pushes the value onto the stack. The 'a' parameter determines whether to use the current position of point p or its position in the original outline. ### Method GC[a] ### Endpoint N/A (Instruction-based) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **a** (Integer) - Required - 0: use current position of point p, 1: use the position of point p in the original outline. * **p** (ULONG) - Required - The point number. ### Request Example ``` GC[1] ``` ### Response #### Success Response (200) * **value** (F26Dot6) - The coordinate location of the point. #### Response Example ``` ``` ``` -------------------------------- ### Example of Function Call with Loop in TrueType Source: https://learn.microsoft.com/en-us/typography/opentype/otspec180/tt_instructions An example demonstrating how to push values, define a function, and then use LOOPCALL to execute that function multiple times. This illustrates the practical application of function definition and calling. ```TrueType PUSHB(000), 17| push 17 onto the stack FDEF[ ]| start defining function 17 ...| contents of function ... ENDF[ ]| end the definition PUSHB(000),5| push count PUSHB(000),17| push function number LOOPCALL[ ]| call function17, 5 times ``` -------------------------------- ### Miscellaneous Instructions Source: https://learn.microsoft.com/en-us/typography/opentype/otspec170/tt_instructions Includes instructions for obtaining information about the current glyph and the scaler version. ```APIDOC ## Miscellaneous instructions The following instruction obtains information about the current glyph and the scaler version. *(Specific details for miscellaneous instructions like 'Get Glyph Info' or 'Get Scaler Version' are not provided in the input text and would require further documentation.)* ``` -------------------------------- ### Ideographic Em-Box Example Values Source: https://learn.microsoft.com/en-us/typography/opentype/otspec150/baselinetags Example values for the ideographic baseline tags and OS/2 fields for the Kozuka Mincho font family, illustrating a square ideographic em-box. This example shows how different fields can define the same metrics. ```text HorizAxis.ideo = -120; HorizAxis.idtp = 880. // If HorizAxis.ideo is not present, and it's a CJK font: OS/2.sTypoDescender = -120; OS/2.sTypoAscender = 880. ``` -------------------------------- ### Example: Function Definition and LoopCall (TrueType) Source: https://learn.microsoft.com/en-us/typography/opentype/otspec160/tt_instructions Illustrates defining function 17 and then calling it 5 times using `LOOPCALL`. This example demonstrates the sequence of `PUSHB`, `FDEF`, `ENDF`, and `LOOPCALL` within the TrueType instruction set. ```TrueType Instruction Set PUSHB(000), 17 FDEF[ ] ... ENDF[ ] PUSHB(000),5 PUSHB(000),17 LOOPCALL[ ] ``` -------------------------------- ### Vertical Header Table Example Source: https://learn.microsoft.com/en-us/typography/opentype/otspec170/vhea An example demonstrating the structure and values within the Vertical Header Table. ```APIDOC ## Vertical Header Table Example ### Description Illustrates the layout and typical values found in the Vertical Header Table. ### Method N/A (Data Structure Documentation) ### Endpoint N/A (Data Structure Documentation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **version** (Offset/length 0/4) - Version number of the vertical header table, in fixed-point format, is 1.1 - **vertTypoAscender** (Offset/length 4/2) - Half the em-square height (1024). - **vertTypoDescender** (Offset/length 6/2) - Minus half the em-square height (-1024). - **vertTypoLineGap** (Offset/length 8/2) - Typographic line gap is 0 FUnits. - **advanceHeightMax** (Offset/length 10/2) - The maximum advance height measurement found in the font is 2079 FUnits. - **minTopSideBearing** (Offset/length 12/2) - The minimum top sidebearing measurement found in the font is -342 FUnits. - **minBottomSideBearing** (Offset/length 14/2) - The minimum bottom sidebearing measurement found in the font is -333 FUnits. - **yMaxExtent** (Offset/length 16/2) - minTopSideBearing + (yMax-yMin) = 2036. - **caretSlopeRise** (Offset/length 18/2) - The caret slope rise of 0 and a caret slope run of 1 indicate a horizontal caret for a vertical font. - **caretSlopeRun** (Offset/length 20/2) - The caret slope rise of 0 and a caret slope run of 1 indicate a horizontal caret for a vertical font. - **caretOffset** (Offset/length 22/2) - Value set to 0 for nonslanted fonts. - **reserved** (Offset/length 24/4) - Set to 0. - **reserved** (Offset/length 26/2) - Set to 0. - **reserved** (Offset/length 28/2) - Set to 0. - **reserved** (Offset/length 30/2) - Set to 0. - **metricDataFormat** (Offset/length 32/2) - Set to 0. - **numOfLongVerMetrics** (Offset/length 34/2) - Number of advance heights in the vertical metrics table is 258. #### Response Example None ``` -------------------------------- ### Calculating Final Normalized Value with 'avar' Mappings - Example Source: https://learn.microsoft.com/en-us/typography/opentype/otspec190/otvaroverview_source=recommendations This example shows how to compute the final normalized value using 'avar' table mappings, interpolating between 'startSeg' and 'endSeg' based on the default normalized value and the ratio. ```plaintext ratio = (defaultNormalizedValue - startSeg.fromCoordinate) / (endSeg.fromCoordinate - startSeg.fromCoordinate) = (-0.5 - (-0.75)) / (0 - (-0.75)) = 0.3333 finalNormalizedValue = startSeg.toCoordinate + ratio * (endSeg.toCoordinate - startSeg.toCoordinate) = -0.5 + 0.3333 * (0 - (-0.5)) = -0.3333 ``` -------------------------------- ### meta Table Example Correction Source: https://learn.microsoft.com/en-us/typography/opentype/spec/changes Notes a correction made to the example provided for Hant-HK in the meta table documentation. ```APIDOC ## meta Table Example Correction ### Description A correction has been made to the description of the example for Hant-HK within the `meta` table documentation. ### Method N/A (Documentation Update) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### Axis Table Example (Horizontal) Source: https://learn.microsoft.com/en-us/typography/opentype/otspec170/base An example of the Horizontal Axis table, providing offsets to the BaseTagList and BaseScriptList tables. ```APIDOC ## Axis Table Example (Horizontal) ### Description This example details the Horizontal Axis table, which includes offsets to the BaseTagList table (defining horizontal baseline tags) and the BaseScriptList table (enumerating scripts rendered horizontally). ### Endpoint N/A (This is a data structure definition) ### Parameters #### Request Body - **HorizBaseTagList** (Offset) - Required - Offset to the BaseTagList table for horizontal baselines. - **HorizBaseScriptList** (Offset) - Required - Offset to the BaseScriptList table for horizontal scripts. ### Request Example ```json { "HorizBaseTagList": "0x0004", "HorizBaseScriptList": "0x0012" } ``` ### Response #### Success Response (200) - **HorizontalAxisTable** (object) - Contains the Horizontal Axis table details. - **HorizBaseTagList** (Offset) - Offset to the BaseTagList table. - **HorizBaseScriptList** (Offset) - Offset to the BaseScriptList table. #### Response Example ```json { "HorizontalAxisTable": { "HorizBaseTagList": "0x0004", "HorizBaseScriptList": "0x0012" } } ``` ```