[Libreoffice-commits] libcdr.git: src/lib
Fridrich Å trba
fridrich.strba at bluewin.ch
Fri Mar 1 01:32:17 PST 2013
src/lib/CDRParser.cpp | 6 ++++--
src/lib/CDRStylesCollector.cpp | 7 ++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
New commits:
commit 6db42e0a640ee09e04a1980675bc1df4f7b79099
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Fri Mar 1 10:31:52 2013 +0100
Some more font encoding hackery
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,
More information about the Libreoffice-commits
mailing list