summaryrefslogtreecommitdiff
path: root/vcl/source/fontsubset
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2019-10-13 09:37:16 +0200
committerJulien Nabet <serval2412@yahoo.fr>2019-10-13 12:28:31 +0200
commit9e4cbac83094c13ffbfd117f534d4275cc1ffb16 (patch)
treeacd2c455101edf469091927a35964b8fefb8ea5a /vcl/source/fontsubset
parent9f5d2305437fd2bb2a6ff00247e8d4d4736f6433 (diff)
Add glyf constants + remove "offset" pattern for length var (vcl)
Change-Id: I35bf0cda789cbbaa5272b78b30a58fa8c4d8c08a Reviewed-on: https://gerrit.libreoffice.org/80726 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'vcl/source/fontsubset')
-rw-r--r--vcl/source/fontsubset/sft.cxx22
-rw-r--r--vcl/source/fontsubset/ttcr.cxx16
2 files changed, 19 insertions, 19 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 9da262cf4a42..7c527887dc65 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -386,15 +386,15 @@ static int GetSimpleTTOutline(TrueTypeFont const *ttf, sal_uInt32 glyphID, Contr
if( glyphID >= ttf->nglyphs ) /*- glyph is not present in the font */
return 0;
const sal_uInt8* ptr = table + ttf->goffsets[glyphID];
- const sal_Int16 numberOfContours = GetInt16(ptr, 0);
+ const sal_Int16 numberOfContours = GetInt16(ptr, GLYF_numberOfContours_offset);
if( numberOfContours <= 0 ) /*- glyph is not simple */
return 0;
if (metrics) { /*- GetCompoundTTOutline() calls this function with NULL metrics -*/
- metrics->xMin = GetInt16(ptr, 2);
- metrics->yMin = GetInt16(ptr, 4);
- metrics->xMax = GetInt16(ptr, 6);
- metrics->yMax = GetInt16(ptr, 8);
+ metrics->xMin = GetInt16(ptr, GLYF_xMin_offset);
+ metrics->yMin = GetInt16(ptr, GLYF_yMin_offset);
+ metrics->xMax = GetInt16(ptr, GLYF_xMax_offset);
+ metrics->yMax = GetInt16(ptr, GLYF_yMax_offset);
GetMetrics(ttf, glyphID, metrics);
}
@@ -516,14 +516,14 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
return 0;
const sal_uInt8* ptr = table + ttf->goffsets[glyphID];
- if (GetInt16(ptr, 0) != -1) /* number of contours - glyph is not compound */
+ if (GetInt16(ptr, GLYF_numberOfContours_offset) != -1) /* number of contours - glyph is not compound */
return 0;
if (metrics) {
- metrics->xMin = GetInt16(ptr, 2);
- metrics->yMin = GetInt16(ptr, 4);
- metrics->xMax = GetInt16(ptr, 6);
- metrics->yMax = GetInt16(ptr, 8);
+ metrics->xMin = GetInt16(ptr, GLYF_xMin_offset);
+ metrics->yMin = GetInt16(ptr, GLYF_yMin_offset);
+ metrics->xMax = GetInt16(ptr, GLYF_xMax_offset);
+ metrics->yMax = GetInt16(ptr, GLYF_yMax_offset);
GetMetrics(ttf, glyphID, metrics);
}
@@ -1639,7 +1639,7 @@ static SFErrCodes doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
table = getTable(t, O_head);
table_size = getTableSize(t, O_head);
- if (table_size < HEAD_Length_offset) {
+ if (table_size < HEAD_Length) {
return SFErrCodes::TtFormat;
}
t->unitsPerEm = GetUInt16(table, HEAD_unitsPerEm_offset);
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index a52f8fda08b0..f6d78ef5520c 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -303,10 +303,10 @@ SFErrCodes StreamToFile(TrueTypeCreator *_this, const char* fname)
/* Table data points to
* --------------------------------------------
* generic tdata_generic struct
- * 'head' HEAD_Length_offset bytes of memory
+ * 'head' HEAD_Length bytes of memory
* 'hhea' HHEA_Length bytes of memory
* 'loca' tdata_loca struct
- * 'maxp' MAXP_Version1Length_offset bytes of memory
+ * 'maxp' MAXP_Version1Length bytes of memory
* 'glyf' list of GlyphData structs (defined in sft.h)
* 'name' list of NameRecord structs (defined in sft.h)
* 'post' tdata_post struct
@@ -503,7 +503,7 @@ static int GetRawData_generic(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32
static int GetRawData_head(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag)
{
- *len = HEAD_Length_offset;
+ *len = HEAD_Length;
*ptr = static_cast<sal_uInt8 *>(_this->data);
*tag = T_head;
@@ -538,7 +538,7 @@ static int GetRawData_loca(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le
static int GetRawData_maxp(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag)
{
- *len = MAXP_Version1Length_offset;
+ *len = MAXP_Version1Length;
*ptr = static_cast<sal_uInt8 *>(_this->data);
*tag = T_maxp;
@@ -858,7 +858,7 @@ TrueTypeTable *TrueTypeTableNew_head(sal_uInt32 fontRevision,
assert(created != nullptr);
TrueTypeTable* table = static_cast<TrueTypeTable*>(smalloc(sizeof(TrueTypeTable)));
- sal_uInt8* ptr = ttmalloc(HEAD_Length_offset);
+ sal_uInt8* ptr = ttmalloc(HEAD_Length);
PutUInt32(0x00010000, ptr, 0); /* version */
PutUInt32(fontRevision, ptr, 4);
@@ -925,10 +925,10 @@ TrueTypeTable *TrueTypeTableNew_loca()
TrueTypeTable *TrueTypeTableNew_maxp( const sal_uInt8* maxp, int size)
{
TrueTypeTable* table = static_cast<TrueTypeTable*>(smalloc(sizeof(TrueTypeTable)));
- table->data = ttmalloc(MAXP_Version1Length_offset);
+ table->data = ttmalloc(MAXP_Version1Length);
- if (maxp && size == MAXP_Version1Length_offset) {
- memcpy(table->data, maxp, MAXP_Version1Length_offset);
+ if (maxp && size == MAXP_Version1Length) {
+ memcpy(table->data, maxp, MAXP_Version1Length);
}
table->tag = T_maxp;