diff options
author | arthurhsu@google.com <arthurhsu@google.com@672e30a5-4c29-85ac-ac6d-611c735e0a51> | 2011-12-09 02:13:39 +0000 |
---|---|---|
committer | arthurhsu@google.com <arthurhsu@google.com@672e30a5-4c29-85ac-ac6d-611c735e0a51> | 2011-12-09 02:13:39 +0000 |
commit | a70737a5b6ca5cd32e1a47adb847e1d016e1502b (patch) | |
tree | 2e20922cac069f544cb8d1950b7e9371570ad34d | |
parent | c73f0572c9f4b2b2d0afacbd1ccd64927cf2c8a3 (diff) | |
download | src-a70737a5b6ca5cd32e1a47adb847e1d016e1502b.tar.gz |
Patch from Nico Weber: remove static initializers.
This is needed because gcc 4.4.3 can't evaluate simple static functions
at compile time.
git-svn-id: http://sfntly.googlecode.com/svn/trunk/cpp/src@116 672e30a5-4c29-85ac-ac6d-611c735e0a51
-rw-r--r-- | sfntly/font.cc | 6 | ||||
-rw-r--r-- | sfntly/tag.cc | 98 |
2 files changed, 55 insertions, 49 deletions
diff --git a/sfntly/font.cc b/sfntly/font.cc index c9798c8..347e0c1 100644 --- a/sfntly/font.cc +++ b/sfntly/font.cc @@ -40,7 +40,8 @@ namespace sfntly { -const int32_t SFNTVERSION_1 = Fixed1616::Fixed(1, 0); +const int32_t SFNTVERSION_MAJOR = 1; +const int32_t SFNTVERSION_MINOR = 0; /****************************************************************************** * Font class @@ -314,7 +315,8 @@ void Font::Builder::RemoveTableBuilder(int32_t tag) { } Font::Builder::Builder(FontFactory* factory) - : factory_(factory), sfnt_version_(SFNTVERSION_1) { + : factory_(factory), + sfnt_version_(Fixed1616::Fixed(SFNTVERSION_MAJOR, SFNTVERSION_MINOR)) { } void Font::Builder::LoadFont(InputStream* is) { diff --git a/sfntly/tag.cc b/sfntly/tag.cc index 893b74d..c9d8c29 100644 --- a/sfntly/tag.cc +++ b/sfntly/tag.cc @@ -17,55 +17,59 @@ #include "sfntly/tag.h" #include "sfntly/port/endian.h" +// Use a macro instead of GenerateTag() because gcc 4.4.3 creates static +// initializers in that case. +#define TAG(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | d); + namespace sfntly { -const int32_t Tag::ttcf = GenerateTag('t', 't', 'c', 'f'); -const int32_t Tag::cmap = GenerateTag('c', 'm', 'a', 'p'); -const int32_t Tag::head = GenerateTag('h', 'e', 'a', 'd'); -const int32_t Tag::hhea = GenerateTag('h', 'h', 'e', 'a'); -const int32_t Tag::hmtx = GenerateTag('h', 'm', 't', 'x'); -const int32_t Tag::maxp = GenerateTag('m', 'a', 'x', 'p'); -const int32_t Tag::name = GenerateTag('n', 'a', 'm', 'e'); -const int32_t Tag::OS_2 = GenerateTag('O', 'S', '/', '2'); -const int32_t Tag::post = GenerateTag('p', 'o', 's', 't'); -const int32_t Tag::cvt = GenerateTag('c', 'v', 't', ' '); -const int32_t Tag::fpgm = GenerateTag('f', 'p', 'g', 'm'); -const int32_t Tag::glyf = GenerateTag('g', 'l', 'y', 'f'); -const int32_t Tag::loca = GenerateTag('l', 'o', 'c', 'a'); -const int32_t Tag::prep = GenerateTag('p', 'r', 'e', 'p'); -const int32_t Tag::CFF = GenerateTag('C', 'F', 'F', ' '); -const int32_t Tag::VORG = GenerateTag('V', 'O', 'R', 'G'); -const int32_t Tag::EBDT = GenerateTag('E', 'B', 'D', 'T'); -const int32_t Tag::EBLC = GenerateTag('E', 'B', 'L', 'C'); -const int32_t Tag::EBSC = GenerateTag('E', 'B', 'S', 'C'); -const int32_t Tag::BASE = GenerateTag('B', 'A', 'S', 'E'); -const int32_t Tag::GDEF = GenerateTag('G', 'D', 'E', 'F'); -const int32_t Tag::GPOS = GenerateTag('G', 'P', 'O', 'S'); -const int32_t Tag::GSUB = GenerateTag('G', 'S', 'U', 'B'); -const int32_t Tag::JSTF = GenerateTag('J', 'S', 'T', 'F'); -const int32_t Tag::DSIG = GenerateTag('D', 'S', 'I', 'G'); -const int32_t Tag::gasp = GenerateTag('g', 'a', 's', 'p'); -const int32_t Tag::hdmx = GenerateTag('h', 'd', 'm', 'x'); -const int32_t Tag::kern = GenerateTag('k', 'e', 'r', 'n'); -const int32_t Tag::LTSH = GenerateTag('L', 'T', 'S', 'H'); -const int32_t Tag::PCLT = GenerateTag('P', 'C', 'L', 'T'); -const int32_t Tag::VDMX = GenerateTag('V', 'D', 'M', 'X'); -const int32_t Tag::vhea = GenerateTag('v', 'h', 'e', 'a'); -const int32_t Tag::vmtx = GenerateTag('v', 'm', 't', 'x'); -const int32_t Tag::bsln = GenerateTag('b', 's', 'l', 'n'); -const int32_t Tag::feat = GenerateTag('f', 'e', 'a', 't'); -const int32_t Tag::lcar = GenerateTag('l', 'c', 'a', 'r'); -const int32_t Tag::morx = GenerateTag('m', 'o', 'r', 'x'); -const int32_t Tag::opbd = GenerateTag('o', 'p', 'b', 'd'); -const int32_t Tag::prop = GenerateTag('p', 'r', 'o', 'p'); -const int32_t Tag::Feat = GenerateTag('F', 'e', 'a', 't'); -const int32_t Tag::Glat = GenerateTag('G', 'l', 'a', 't'); -const int32_t Tag::Gloc = GenerateTag('G', 'l', 'o', 'c'); -const int32_t Tag::Sile = GenerateTag('S', 'i', 'l', 'e'); -const int32_t Tag::Silf = GenerateTag('S', 'i', 'l', 'f'); -const int32_t Tag::bhed = GenerateTag('b', 'h', 'e', 'd'); -const int32_t Tag::bdat = GenerateTag('b', 'd', 'a', 't'); -const int32_t Tag::bloc = GenerateTag('b', 'l', 'o', 'c'); +const int32_t Tag::ttcf = TAG('t', 't', 'c', 'f'); +const int32_t Tag::cmap = TAG('c', 'm', 'a', 'p'); +const int32_t Tag::head = TAG('h', 'e', 'a', 'd'); +const int32_t Tag::hhea = TAG('h', 'h', 'e', 'a'); +const int32_t Tag::hmtx = TAG('h', 'm', 't', 'x'); +const int32_t Tag::maxp = TAG('m', 'a', 'x', 'p'); +const int32_t Tag::name = TAG('n', 'a', 'm', 'e'); +const int32_t Tag::OS_2 = TAG('O', 'S', '/', '2'); +const int32_t Tag::post = TAG('p', 'o', 's', 't'); +const int32_t Tag::cvt = TAG('c', 'v', 't', ' '); +const int32_t Tag::fpgm = TAG('f', 'p', 'g', 'm'); +const int32_t Tag::glyf = TAG('g', 'l', 'y', 'f'); +const int32_t Tag::loca = TAG('l', 'o', 'c', 'a'); +const int32_t Tag::prep = TAG('p', 'r', 'e', 'p'); +const int32_t Tag::CFF = TAG('C', 'F', 'F', ' '); +const int32_t Tag::VORG = TAG('V', 'O', 'R', 'G'); +const int32_t Tag::EBDT = TAG('E', 'B', 'D', 'T'); +const int32_t Tag::EBLC = TAG('E', 'B', 'L', 'C'); +const int32_t Tag::EBSC = TAG('E', 'B', 'S', 'C'); +const int32_t Tag::BASE = TAG('B', 'A', 'S', 'E'); +const int32_t Tag::GDEF = TAG('G', 'D', 'E', 'F'); +const int32_t Tag::GPOS = TAG('G', 'P', 'O', 'S'); +const int32_t Tag::GSUB = TAG('G', 'S', 'U', 'B'); +const int32_t Tag::JSTF = TAG('J', 'S', 'T', 'F'); +const int32_t Tag::DSIG = TAG('D', 'S', 'I', 'G'); +const int32_t Tag::gasp = TAG('g', 'a', 's', 'p'); +const int32_t Tag::hdmx = TAG('h', 'd', 'm', 'x'); +const int32_t Tag::kern = TAG('k', 'e', 'r', 'n'); +const int32_t Tag::LTSH = TAG('L', 'T', 'S', 'H'); +const int32_t Tag::PCLT = TAG('P', 'C', 'L', 'T'); +const int32_t Tag::VDMX = TAG('V', 'D', 'M', 'X'); +const int32_t Tag::vhea = TAG('v', 'h', 'e', 'a'); +const int32_t Tag::vmtx = TAG('v', 'm', 't', 'x'); +const int32_t Tag::bsln = TAG('b', 's', 'l', 'n'); +const int32_t Tag::feat = TAG('f', 'e', 'a', 't'); +const int32_t Tag::lcar = TAG('l', 'c', 'a', 'r'); +const int32_t Tag::morx = TAG('m', 'o', 'r', 'x'); +const int32_t Tag::opbd = TAG('o', 'p', 'b', 'd'); +const int32_t Tag::prop = TAG('p', 'r', 'o', 'p'); +const int32_t Tag::Feat = TAG('F', 'e', 'a', 't'); +const int32_t Tag::Glat = TAG('G', 'l', 'a', 't'); +const int32_t Tag::Gloc = TAG('G', 'l', 'o', 'c'); +const int32_t Tag::Sile = TAG('S', 'i', 'l', 'e'); +const int32_t Tag::Silf = TAG('S', 'i', 'l', 'f'); +const int32_t Tag::bhed = TAG('b', 'h', 'e', 'd'); +const int32_t Tag::bdat = TAG('b', 'd', 'a', 't'); +const int32_t Tag::bloc = TAG('b', 'l', 'o', 'c'); const int32_t CFF_TABLE_ORDERING[] = { Tag::head, |