diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2013-03-01 10:31:52 +0100 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2013-03-01 10:31:52 +0100 |
commit | 6db42e0a640ee09e04a1980675bc1df4f7b79099 (patch) | |
tree | 67c7c7fcd66f74114ee206afcb65d4d359d98810 | |
parent | 4c9a34b15ba348da33e5107514ec4e3eb34fea24 (diff) |
Some more font encoding hackerylibcdr-0.0.11
-rw-r--r-- | src/lib/CDRParser.cpp | 6 | ||||
-rw-r--r-- | src/lib/CDRStylesCollector.cpp | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp index 1ce77ae..99526c0 100644 --- a/src/lib/CDRParser.cpp +++ b/src/lib/CDRParser.cpp @@ -95,6 +95,8 @@ static void processNameForEncoding(WPXString &name, unsigned short &encoding) encoding = 0xcc; else if ((found=fontName.rfind(" Cyr")) != std::string::npos) encoding = 0xcc; + else if ((found=fontName.rfind(" CYR")) != std::string::npos) + encoding = 0xcc; else if ((found=fontName.rfind(" Baltic")) != std::string::npos) encoding = 0xba; else if ((found=fontName.rfind(" Greek")) != std::string::npos) @@ -2348,8 +2350,8 @@ void libcdr::CDRParser::readFont(WPXInputStream *input, unsigned length) { if (!_redirectX6Chunk(&input, length)) throw GenericException(); - unsigned fontId = readU32(input); - unsigned short fontEncoding = fontId >> 16; + unsigned short fontId = readU16(input); + unsigned short fontEncoding = readU16(input); input->seek(14, WPX_SEEK_CUR); WPXString name; if (m_version >= 1200) diff --git a/src/lib/CDRStylesCollector.cpp b/src/lib/CDRStylesCollector.cpp index 1bbb1ea..8b45750 100644 --- a/src/lib/CDRStylesCollector.cpp +++ b/src/lib/CDRStylesCollector.cpp @@ -241,7 +241,12 @@ void libcdr::CDRStylesCollector::collectPaletteEntry(unsigned colorId, unsigned void libcdr::CDRStylesCollector::collectFont(unsigned fontId, unsigned short encoding, const WPXString &font) { - m_ps.m_fonts[fontId] = CDRFont(font, encoding); + std::map<unsigned, CDRFont>::const_iterator iter = m_ps.m_fonts.find(fontId); + // Asume that the first font with the given ID is a font + // that we want, the others are substitution fonts. We might + // be utterly wrong in this one + if (iter == m_ps.m_fonts.end()) + m_ps.m_fonts[fontId] = CDRFont(font, encoding); } void libcdr::CDRStylesCollector::collectText(unsigned textId, unsigned styleId, const std::vector<unsigned char> &data, |