summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2019-10-12 19:31:02 +0200
committerJulien Nabet <serval2412@yahoo.fr>2019-10-12 23:31:30 +0200
commit6f0e2cc38bbdb9fe115f3df38d7a596416d34bc2 (patch)
treee2e87c81c1732bb9cbae6200e60fedcdeefe5bdd /vcl/inc
parentd6ea967e040d01ec69649ac689472018e477db34 (diff)
Document and replace some magic values in sft/ttcr (vcl)
Change-Id: Id9c3f96acb7b93c7ef215ae33d98ad17ef45095c Reviewed-on: https://gerrit.libreoffice.org/80719 Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> Tested-by: Jenkins
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/sft.hxx216
1 files changed, 216 insertions, 0 deletions
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index aa81dcd151cb..39bc2ecfd421 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -185,6 +185,222 @@ namespace vcl
struct TrueTypeFont;
+/*
+ Some table OS/2 consts
+ quick history:
+ OpenType has been created from TrueType
+ - original TrueType had an OS/2 table with a length of 68 bytes
+ (cf https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html)
+ - There have been 6 versions (from version 0 to 5)
+ (cf https://docs.microsoft.com/en-us/typography/opentype/otspec140/os2ver0)
+
+ For the record:
+ // From Initial TrueType version
+ TYPE NAME FROM BYTE
+ uint16 version 0
+ int16 xAvgCharWidth 2
+ uint16 usWeightClass 4
+ uint16 usWidthClass 6
+ uint16 fsType 8
+ int16 ySubscriptXSize 10
+ int16 ySubscriptYSize 12
+ int16 ySubscriptXOffset 14
+ int16 ySubscriptYOffset 16
+ int16 ySuperscriptXSize 18
+ int16 ySuperscriptYSize 20
+ int16 ySuperscriptXOffset 22
+ int16 ySuperscriptYOffset 24
+ int16 yStrikeoutSize 26
+ int16 yStrikeoutPosition 28
+ int16 sFamilyClass 30
+ uint8 panose[10] 32
+ uint32 ulUnicodeRange1 42
+ uint32 ulUnicodeRange2 46
+ uint32 ulUnicodeRange3 50
+ uint32 ulUnicodeRange4 54
+ Tag achVendID 58
+ uint16 fsSelection 62
+ uint16 usFirstCharIndex 64
+ uint16 usLastCharIndex 66
+
+ // From Version 0 of OpenType
+ int16 sTypoAscender 68
+ int16 sTypoDescender 70
+ int16 sTypoLineGap 72
+ uint16 usWinAscent 74
+ uint16 usWinDescent 76
+
+ => length for OpenType version 0 = 78 bytes
+
+ // From Version 1 of OpenType
+ uint32 ulCodePageRange1 78
+ uint32 ulCodePageRange2 82
+
+ => length for OpenType version 1 = 86 bytes
+
+ // From Version 2 of OpenType
+ // (idem for Versions 3 and 4)
+ int16 sxHeight 86
+ int16 sCapHeight 88
+ uint16 usDefaultChar 90
+ uint16 usBreakChar 92
+ uint16 usMaxContext 94
+
+ => length for OpenType version 2, 3 and 4 = 96 bytes
+
+ // From Version 5 of OpenType
+ uint16 usLowerOpticalPointSize 96
+ uint16 usUpperOpticalPointSize 98
+ END 100
+
+ => length for OS/2 table version 5 = 100 bytes
+
+*/
+static const int OS2_Legacy_length = 68;
+static const int OS2_V0_length = 78;
+static const int OS2_V1_length = 86;
+
+static const int OS2_usWeightClass_offset = 4;
+static const int OS2_usWidthClass_offset = 6;
+static const int OS2_fsType_offset = 8;
+static const int OS2_panose_offset = 32;
+static const int OS2_panoseNbBytes_offset = 10;
+static const int OS2_ulUnicodeRange1_offset = 42;
+static const int OS2_ulUnicodeRange2_offset = 46;
+static const int OS2_ulUnicodeRange3_offset = 50;
+static const int OS2_ulUnicodeRange4_offset = 54;
+static const int OS2_fsSelection_offset = 62;
+static const int OS2_typoAscender_offset = 68;
+static const int OS2_typoDescender_offset = 70;
+static const int OS2_typoLineGap_offset = 72;
+static const int OS2_winAscent_offset = 74;
+static const int OS2_winDescent_offset = 76;
+static const int OS2_ulCodePageRange1_offset = 78;
+static const int OS2_ulCodePageRange2_offset = 82;
+
+/*
+ Some table hhea consts
+ cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/hhea
+ TYPE NAME FROM BYTE
+ uint16 majorVersion 0
+ uint16 minorVersion 2
+ FWORD ascender 4
+ FWORD descender 6
+ FWORD lineGap 8
+ UFWORD advanceWidthMax 10
+ FWORD minLeftSideBearing 12
+ FWORD minRightSideBearing 14
+ FWORD xMaxExtent 16
+ int16 caretSlopeRise 18
+ int16 caretSlopeRun 20
+ int16 caretOffset 22
+ int16 (reserved) 24
+ int16 (reserved) 26
+ int16 (reserved) 28
+ int16 (reserved) 30
+ int16 metricDataFormat 32
+ uint16 numberOfHMetrics 34
+ END 36
+
+ => length for hhea table = 36 bytes
+
+*/
+static const int HHEA_Length = 36;
+
+static const int HHEA_ascender_offset = 4;
+static const int HHEA_descender_offset = 6;
+static const int HHEA_lineGap_offset = 8;
+static const int HHEA_caretSlopeRise_offset = 18;
+static const int HHEA_caretSlopeRun_offset = 20;
+
+/*
+ Some table post consts
+ cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/post
+ TYPE NAME FROM BYTE
+ Fixed version 0
+ Fixed italicAngle 4
+ FWord underlinePosition 8
+ FWord underlineThickness 10
+ uint32 isFixedPitch 12
+ ...
+
+*/
+static const int POST_italicAngle_offset = 4;
+static const int POST_underlinePosition_offset = 8;
+static const int POST_underlineThickness_offset = 10;
+static const int POST_isFixedPitch_offset = 12;
+
+/*
+ Some table head consts
+ cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/head
+ TYPE NAME FROM BYTE
+ uit16 majorVersion 0
+ uit16 minorVersion 2
+ Fixed fontRevision 4
+ uint32 checkSumAdjustment 8
+ uint32 magicNumber 12 (= 0x5F0F3CF5)
+ uint16 flags 16
+ uint16 unitsPerEm 18
+ LONGDATETIME created 20
+ LONGDATETIME modified 28
+ int16 xMin 36
+ int16 yMin 38
+ int16 xMax 40
+ int16 yMax 42
+ uint16 macStyle 44
+ uint16 lowestRecPPEM 46
+ int16 fontDirectionHint 48
+ int16 indexToLocFormat 50
+ int16 glyphDataFormat 52
+
+ END 54
+
+ => length head table = 54 bytes
+*/
+static const int HEAD_Length_offset = 54;
+
+static const int HEAD_majorVersion_offset = 0;
+static const int HEAD_fontRevision_offset = 4;
+static const int HEAD_magicNumber_offset = 12;
+static const int HEAD_flags_offset = 16;
+static const int HEAD_unitsPerEm_offset = 18;
+static const int HEAD_created_offset = 20;
+static const int HEAD_xMin_offset = 36;
+static const int HEAD_yMin_offset = 38;
+static const int HEAD_xMax_offset = 40;
+static const int HEAD_yMax_offset = 42;
+static const int HEAD_macStyle_offset = 44;
+static const int HEAD_lowestRecPPEM_offset = 46;
+static const int HEAD_fontDirectionHint_offset = 48;
+static const int HEAD_indexToLocFormat_offset = 50;
+static const int HEAD_glyphDataFormat_offset = 52;
+
+/*
+ Some table maxp consts
+ cf https://docs.microsoft.com/fr-fr/typography/opentype/spec/maxp
+ For 0.5 version
+ TYPE NAME FROM BYTE
+ Fixed version 0
+ uint16 numGlyphs 4
+
+ For 1.0 Version
+ Fixed version 0
+ uint16 numGlyphs 4
+ uint16 maxPoints 6
+ uint16 maxContours 8
+ uint16 maxCompositePoints 10
+ uint16 maxCompositeContours 12
+ ...
+
+*/
+static const int MAXP_Version1Length_offset = 32;
+
+static const int MAXP_numGlyphs_offset = 4;
+static const int MAXP_maxPoints_offset = 6;
+static const int MAXP_maxContours_offset = 8;
+static const int MAXP_maxCompositePoints_offset = 10;
+static const int MAXP_maxCompositeContours_offset = 12;
+
/**
* @defgroup sft Sun Font Tools Exported Functions
*/