Fixes to sfntly to get it to compile correctly with -fPIC and g++ (remove inline method definitions)

This commit is contained in:
Kovid Goyal 2012-10-30 11:33:46 +05:30
parent 929ad31af9
commit d51de87c61
2 changed files with 22 additions and 4 deletions

View File

@ -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) {

View File

@ -51,8 +51,8 @@ class LocaTable : public Table, public RefCounted<LocaTable> {
// 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<LocaTable> {
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