diff --git a/src/sfntly/src/sfntly/table/truetype/loca_table.cc b/src/sfntly/src/sfntly/table/truetype/loca_table.cc index c692155da8..793f9a90ff 100644 --- a/src/sfntly/src/sfntly/table/truetype/loca_table.cc +++ b/src/sfntly/src/sfntly/table/truetype/loca_table.cc @@ -47,6 +47,17 @@ int32_t LocaTable::NumLocas() { return num_glyphs_ + 1; } +// Changed by Kovid: The following two methods must not have inline +// definitions, otherwise they give incorrect results when compiled with gcc +// and -fPIC, leading to corrupted font generation. +int32_t LocaTable::num_glyphs() { + return num_glyphs_; +} + +int32_t LocaTable::format_version() { + return format_version_; +} + int32_t LocaTable::Loca(int32_t index) { if (index > num_glyphs_) { #if !defined (SFNTLY_NO_EXCEPTION) @@ -101,6 +112,13 @@ LocaTable::Builder::Builder(Header* header, ReadableFontData* data) LocaTable::Builder::~Builder() {} +// Changed by Kovid: The following two methods must not have inline +// definitions, otherwise they give incorrect results when compiled with gcc +// and -fPIC, leading to corrupted font generation. +int32_t LocaTable::Builder::format_version() { return format_version_; } + +void LocaTable::Builder::set_format_version(int32_t value) { format_version_ = value; } + CALLER_ATTACH LocaTable::Builder* LocaTable::Builder::CreateBuilder(Header* header, WritableFontData* data) { diff --git a/src/sfntly/src/sfntly/table/truetype/loca_table.h b/src/sfntly/src/sfntly/table/truetype/loca_table.h index 67c5749b05..b4e1d3ceab 100644 --- a/src/sfntly/src/sfntly/table/truetype/loca_table.h +++ b/src/sfntly/src/sfntly/table/truetype/loca_table.h @@ -51,8 +51,8 @@ class LocaTable : public Table, public RefCounted { // Get the format version that will be used when the loca table is // generated. // @return the loca table format version - int32_t format_version() { return format_version_; } - void set_format_version(int32_t value) { format_version_ = value; } + int32_t format_version(); + void set_format_version(int32_t value); // Gets the List of locas for loca table builder. These may be manipulated // in any way by the caller and the changes will be reflected in the final @@ -140,8 +140,8 @@ class LocaTable : public Table, public RefCounted { virtual ~LocaTable(); - int32_t format_version() { return format_version_; } - int32_t num_glyphs() { return num_glyphs_; } + int32_t format_version(); + int32_t num_glyphs(); // Return the offset for the given glyph id. Valid glyph ids are from 0 to the // one less than the number of glyphs. The zero entry is the special entry for