summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2016-01-18 12:26:52 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2016-01-18 12:26:52 +0100
commite076cd1b5a400b32a8aa49fc87feaf3b1d3ba52e (patch)
tree6b55700cb51b58352b8e2909fd092e53791f997f
parent49e7e5482d979866ac92981af0cf83d09610bc80 (diff)
Read and use the information about scaling of the width of font
Change-Id: Ica723149a7165577323a7eb6a258cd8bd79026b3
-rw-r--r--src/lib/VSD5Parser.cpp9
-rw-r--r--src/lib/VSD6Parser.cpp9
-rw-r--r--src/lib/VSDCharacterList.cpp16
-rw-r--r--src/lib/VSDCharacterList.h2
-rw-r--r--src/lib/VSDCollector.h7
-rw-r--r--src/lib/VSDContentCollector.cpp21
-rw-r--r--src/lib/VSDContentCollector.h7
-rw-r--r--src/lib/VSDParser.cpp11
-rw-r--r--src/lib/VSDStyles.h20
-rw-r--r--src/lib/VSDStylesCollector.cpp6
-rw-r--r--src/lib/VSDStylesCollector.h7
-rw-r--r--src/lib/VSDXMLParserBase.cpp11
12 files changed, 71 insertions, 55 deletions
diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp
index 31cc1c0..7900fa5 100644
--- a/src/lib/VSD5Parser.cpp
+++ b/src/lib/VSD5Parser.cpp
@@ -296,7 +296,8 @@ void libvisio::VSD5Parser::readCharIX(librevenge::RVNGInputStream *input)
if (fontMod & 1) superscript = true;
if (fontMod & 2) subscript = true;
- input->seek(4, librevenge::RVNG_SEEK_CUR);
+ double scaleWidth = (double)(readU16(input)) / 10000.0;
+ input->seek(2, librevenge::RVNG_SEEK_CUR);
double fontSize = readDouble(input);
#if 0
@@ -309,7 +310,7 @@ void libvisio::VSD5Parser::readCharIX(librevenge::RVNGInputStream *input)
if (m_isInStyles)
m_collector->collectCharIXStyle(m_header.id, m_header.level, charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript);
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth);
else
{
if (m_isStencilStarted)
@@ -319,10 +320,10 @@ void libvisio::VSD5Parser::readCharIX(librevenge::RVNGInputStream *input)
m_shape.m_charStyle.override(VSDOptionalCharStyle(charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript));
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth));
m_shape.m_charList.addCharIX(m_header.id, m_header.level, charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript);
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth);
}
}
diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp
index d126433..c5d8b79 100644
--- a/src/lib/VSD6Parser.cpp
+++ b/src/lib/VSD6Parser.cpp
@@ -139,7 +139,8 @@ void libvisio::VSD6Parser::readCharIX(librevenge::RVNGInputStream *input)
if (fontMod & 1) superscript = true;
if (fontMod & 2) subscript = true;
- input->seek(4, librevenge::RVNG_SEEK_CUR);
+ double scaleWidth = (double)(readU16(input)) / 10000.0;
+ input->seek(2, librevenge::RVNG_SEEK_CUR);
double fontSize = readDouble(input);
fontMod = readU8(input);
@@ -150,7 +151,7 @@ void libvisio::VSD6Parser::readCharIX(librevenge::RVNGInputStream *input)
if (m_isInStyles)
m_collector->collectCharIXStyle(m_header.id, m_header.level, charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript);
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth);
else
{
if (m_isStencilStarted)
@@ -160,10 +161,10 @@ void libvisio::VSD6Parser::readCharIX(librevenge::RVNGInputStream *input)
m_shape.m_charStyle.override(VSDOptionalCharStyle(charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript));
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth));
m_shape.m_charList.addCharIX(m_header.id, m_header.level, charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript);
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth);
}
}
diff --git a/src/lib/VSDCharacterList.cpp b/src/lib/VSDCharacterList.cpp
index 74b1049..49b8678 100644
--- a/src/lib/VSDCharacterList.cpp
+++ b/src/lib/VSDCharacterList.cpp
@@ -34,9 +34,9 @@ public:
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
- const boost::optional<bool> &subscript) : VSDCharacterListElement(id, level),
+ const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth) : VSDCharacterListElement(id, level),
m_style(charCount, font, fontColour, fontSize, bold, italic, underline, doubleunderline, strikeout,
- doublestrikeout, allcaps, initcaps, smallcaps, superscript, subscript) {}
+ doublestrikeout, allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth) {}
VSDCharIX(unsigned id, unsigned level, const VSDOptionalCharStyle &style) : VSDCharacterListElement(id, level), m_style(style) {}
~VSDCharIX() {}
void handle(VSDCollector *collector) const;
@@ -60,7 +60,7 @@ void libvisio::VSDCharIX::handle(VSDCollector *collector) const
collector->collectCharIX(m_id, m_level, m_style.charCount, m_style.font, m_style.colour, m_style.size,
m_style.bold, m_style.italic, m_style.underline, m_style.doubleunderline, m_style.strikeout,
m_style.doublestrikeout, m_style.allcaps, m_style.initcaps, m_style.smallcaps,
- m_style.superscript, m_style.subscript);
+ m_style.superscript, m_style.subscript, m_style.scaleWidth);
}
libvisio::VSDCharacterListElement *libvisio::VSDCharIX::clone()
@@ -68,7 +68,7 @@ libvisio::VSDCharacterListElement *libvisio::VSDCharIX::clone()
return new VSDCharIX(m_id, m_level, m_style.charCount, m_style.font, m_style.colour, m_style.size,
m_style.bold, m_style.italic, m_style.underline, m_style.doubleunderline, m_style.strikeout,
m_style.doublestrikeout, m_style.allcaps, m_style.initcaps, m_style.smallcaps,
- m_style.superscript, m_style.subscript);
+ m_style.superscript, m_style.subscript, m_style.scaleWidth);
}
@@ -107,7 +107,7 @@ void libvisio::VSDCharacterList::addCharIX(unsigned id, unsigned level, unsigned
const boost::optional<bool> &bold, const boost::optional<bool> &italic, const boost::optional<bool> &underline,
const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout,
const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps,
- const boost::optional<bool> &superscript, const boost::optional<bool> &subscript)
+ const boost::optional<bool> &superscript, const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth)
{
VSDCharIX *tmpElement = dynamic_cast<VSDCharIX *>(m_elements[id]);
if (!tmpElement)
@@ -116,18 +116,18 @@ void libvisio::VSDCharacterList::addCharIX(unsigned id, unsigned level, unsigned
delete m_elements[id];
m_elements[id] = new VSDCharIX(id, level, charCount, font, fontColour, fontSize, bold, italic, underline, doubleunderline,
- strikeout, doublestrikeout, allcaps, initcaps, smallcaps, superscript, subscript);
+ strikeout, doublestrikeout, allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth);
}
else
tmpElement->m_style.override(VSDOptionalCharStyle(charCount, font, fontColour, fontSize, bold, italic, underline,
- doubleunderline, strikeout, doublestrikeout, allcaps, initcaps, smallcaps, superscript, subscript));
+ doubleunderline, strikeout, doublestrikeout, allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth));
}
void libvisio::VSDCharacterList::addCharIX(unsigned id, unsigned level, const VSDOptionalCharStyle &style)
{
addCharIX(id, level, style.charCount, style.font, style.colour, style.size, style.bold, style.italic, style.underline,
style.doubleunderline, style.strikeout, style.doublestrikeout, style.allcaps, style.initcaps, style.smallcaps,
- style.superscript, style.subscript);
+ style.superscript, style.subscript, style.scaleWidth);
}
unsigned libvisio::VSDCharacterList::getCharCount(unsigned id) const
diff --git a/src/lib/VSDCharacterList.h b/src/lib/VSDCharacterList.h
index 970df93..5211384 100644
--- a/src/lib/VSDCharacterList.h
+++ b/src/lib/VSDCharacterList.h
@@ -33,7 +33,7 @@ public:
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
- const boost::optional<bool> &subscript);
+ const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth);
void addCharIX(unsigned id, unsigned level, const VSDOptionalCharStyle &style);
unsigned getCharCount(unsigned id) const;
void setCharCount(unsigned id, unsigned charCount);
diff --git a/src/lib/VSDCollector.h b/src/lib/VSDCollector.h
index 201a759..6e16bc2 100644
--- a/src/lib/VSDCollector.h
+++ b/src/lib/VSDCollector.h
@@ -80,12 +80,13 @@ public:
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
- const boost::optional<bool> &subscript) = 0;
+ const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth) = 0;
virtual void collectDefaultCharStyle(unsigned charCount, const boost::optional<VSDName> &font, const boost::optional<Colour> &fontColour,
const boost::optional<double> &fontSize, const boost::optional<bool> &bold, const boost::optional<bool> &italic,
const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout,
const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps,
- const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript, const boost::optional<bool> &subscript) = 0;
+ const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript, const boost::optional<bool> &subscript,
+ const boost::optional<double> &scaleWidth) = 0;
virtual void collectParaIX(unsigned id, unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
const boost::optional<double> &indLeft, const boost::optional<double> &indRight, const boost::optional<double> &spLine,
const boost::optional<double> &spBefore, const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align,
@@ -129,7 +130,7 @@ public:
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
- const boost::optional<bool> &subscript) = 0;
+ const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth) = 0;
virtual void collectParaIXStyle(unsigned id, unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
const boost::optional<double> &indLeft, const boost::optional<double> &indRight, const boost::optional<double> &spLine,
const boost::optional<double> &spBefore, const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align,
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index e65359d..16c7a34 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -824,6 +824,7 @@ void libvisio::VSDContentCollector::_fillCharProperties(librevenge::RVNGProperty
if (style.smallcaps) propList.insert("fo:font-variant", "small-caps");
if (style.superscript) propList.insert("style:text-position", "super");
if (style.subscript) propList.insert("style:text-position", "sub");
+ if (style.scaleWidth != 1.0) propList.insert("style:text-scale", style.scaleWidth, librevenge::RVNG_PERCENT);
propList.insert("fo:font-size", style.size*72.0, librevenge::RVNG_POINT);
Colour colour = style.colour;
const Colour *pColour = m_currentLayerList.getColour(m_currentLayerMem);
@@ -2397,12 +2398,12 @@ void libvisio::VSDContentCollector::collectCharIX(unsigned /* id */ , unsigned l
const boost::optional<VSDName> &font, const boost::optional<Colour> &fontColour, const boost::optional<double> &fontSize, const boost::optional<bool> &bold,
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout,
const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps,
- const boost::optional<bool> &superscript, const boost::optional<bool> &subscript)
+ const boost::optional<bool> &superscript, const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth)
{
_handleLevelChange(level);
VSDCharStyle format(m_defaultCharStyle);
format.override(VSDOptionalCharStyle(charCount, font, fontColour, fontSize, bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript));
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth));
format.charCount = charCount;
m_charFormats.push_back(format);
}
@@ -2418,13 +2419,15 @@ void libvisio::VSDContentCollector::collectTabsDataList(unsigned level, const st
}
void libvisio::VSDContentCollector::collectDefaultCharStyle(unsigned charCount,
- const boost::optional<VSDName> &font, const boost::optional<Colour> &fontColour, const boost::optional<double> &fontSize, const boost::optional<bool> &bold,
- const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout,
- const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps,
- const boost::optional<bool> &superscript, const boost::optional<bool> &subscript)
+ const boost::optional<VSDName> &font, const boost::optional<Colour> &fontColour, const boost::optional<double> &fontSize,
+ const boost::optional<bool> &bold, const boost::optional<bool> &italic, const boost::optional<bool> &underline,
+ const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout,
+ const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps,
+ const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript, const boost::optional<bool> &subscript,
+ const boost::optional<double> &scaleWidth)
{
m_defaultCharStyle.override(VSDOptionalCharStyle(charCount, font, fontColour, fontSize, bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript));
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth));
}
void libvisio::VSDContentCollector::collectTextBlock(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
@@ -2527,10 +2530,10 @@ void libvisio::VSDContentCollector::collectCharIXStyle(unsigned /* id */, unsign
const boost::optional<bool> &bold, const boost::optional<bool> &italic, const boost::optional<bool> &underline,
const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout,
const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps,
- const boost::optional<bool> &superscript, const boost::optional<bool> &subscript)
+ const boost::optional<bool> &superscript, const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth)
{
VSDOptionalCharStyle charStyle(charCount, font, fontColour, fontSize, bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript);
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth);
m_styles.addCharStyle(m_currentStyleSheet, charStyle);
}
diff --git a/src/lib/VSDContentCollector.h b/src/lib/VSDContentCollector.h
index ca7a73e..3e2fb38 100644
--- a/src/lib/VSDContentCollector.h
+++ b/src/lib/VSDContentCollector.h
@@ -100,12 +100,13 @@ public:
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
- const boost::optional<bool> &subscript);
+ const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth);
void collectDefaultCharStyle(unsigned charCount, const boost::optional<VSDName> &font, const boost::optional<Colour> &fontColour,
const boost::optional<double> &fontSize, const boost::optional<bool> &bold, const boost::optional<bool> &italic,
const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout,
const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps,
- const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript, const boost::optional<bool> &subscript);
+ const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript, const boost::optional<bool> &subscript,
+ const boost::optional<double> &scaleWidth);
void collectParaIX(unsigned id, unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
const boost::optional<double> &indLeft, const boost::optional<double> &indRight, const boost::optional<double> &spLine,
const boost::optional<double> &spBefore, const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align,
@@ -149,7 +150,7 @@ public:
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
- const boost::optional<bool> &subscript);
+ const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth);
void collectParaIXStyle(unsigned id, unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
const boost::optional<double> &indLeft, const boost::optional<double> &indRight, const boost::optional<double> &spLine,
const boost::optional<double> &spBefore, const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align,
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index fd85a2c..22b356e 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -676,7 +676,7 @@ void libvisio::VSDParser::_flushShape()
m_shape.m_charStyle.size, m_shape.m_charStyle.bold, m_shape.m_charStyle.italic, m_shape.m_charStyle.underline,
m_shape.m_charStyle.doubleunderline, m_shape.m_charStyle.strikeout, m_shape.m_charStyle.doublestrikeout,
m_shape.m_charStyle.allcaps, m_shape.m_charStyle.initcaps, m_shape.m_charStyle.smallcaps,
- m_shape.m_charStyle.superscript, m_shape.m_charStyle.subscript);
+ m_shape.m_charStyle.superscript, m_shape.m_charStyle.subscript, m_shape.m_charStyle.scaleWidth);
m_shape.m_charList.handle(m_collector);
@@ -1877,7 +1877,8 @@ void libvisio::VSDParser::readCharIX(librevenge::RVNGInputStream *input)
if (fontMod & 1) superscript = true;
if (fontMod & 2) subscript = true;
- input->seek(4, librevenge::RVNG_SEEK_CUR);
+ double scaleWidth = (double)(readU16(input)) / 10000.0;
+ input->seek(2, librevenge::RVNG_SEEK_CUR);
double fontSize = readDouble(input);
fontMod = readU8(input);
@@ -1888,7 +1889,7 @@ void libvisio::VSDParser::readCharIX(librevenge::RVNGInputStream *input)
if (m_isInStyles)
m_collector->collectCharIXStyle(m_header.id, m_header.level, charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript);
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth);
else
{
if (m_isStencilStarted)
@@ -1898,10 +1899,10 @@ void libvisio::VSDParser::readCharIX(librevenge::RVNGInputStream *input)
m_shape.m_charStyle.override(VSDOptionalCharStyle(charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript));
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth));
m_shape.m_charList.addCharIX(m_header.id, m_header.level, charCount, font, fontColour, fontSize,
bold, italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript);
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth);
}
}
diff --git a/src/lib/VSDStyles.h b/src/lib/VSDStyles.h
index 2a592fa..9c518d5 100644
--- a/src/lib/VSDStyles.h
+++ b/src/lib/VSDStyles.h
@@ -214,21 +214,21 @@ struct VSDOptionalCharStyle
{
VSDOptionalCharStyle()
: charCount(0), font(), colour(), size(), bold(), italic(), underline(), doubleunderline(), strikeout(),
- doublestrikeout(), allcaps(), initcaps(), smallcaps(), superscript(), subscript() {}
+ doublestrikeout(), allcaps(), initcaps(), smallcaps(), superscript(), subscript(), scaleWidth() {}
VSDOptionalCharStyle(unsigned cc, const boost::optional<VSDName> &ft,
const boost::optional<Colour> &c, const boost::optional<double> &s, const boost::optional<bool> &b,
const boost::optional<bool> &i, const boost::optional<bool> &u, const boost::optional<bool> &du,
const boost::optional<bool> &so, const boost::optional<bool> &dso, const boost::optional<bool> &ac,
const boost::optional<bool> &ic, const boost::optional<bool> &sc, const boost::optional<bool> &super,
- const boost::optional<bool> &sub) :
+ const boost::optional<bool> &sub, const boost::optional<double> &sw) :
charCount(cc), font(ft), colour(c), size(s), bold(b), italic(i), underline(u), doubleunderline(du),
strikeout(so), doublestrikeout(dso), allcaps(ac), initcaps(ic), smallcaps(sc), superscript(super),
- subscript(sub) {}
+ subscript(sub), scaleWidth(sw) {}
VSDOptionalCharStyle(const VSDOptionalCharStyle &style) :
charCount(style.charCount), font(style.font), colour(style.colour), size(style.size), bold(style.bold),
italic(style.italic), underline(style.underline), doubleunderline(style.doubleunderline), strikeout(style.strikeout),
doublestrikeout(style.doublestrikeout), allcaps(style.allcaps), initcaps(style.initcaps), smallcaps(style.smallcaps),
- superscript(style.superscript), subscript(style.subscript) {}
+ superscript(style.superscript), subscript(style.subscript), scaleWidth(style.scaleWidth) {}
~VSDOptionalCharStyle() {}
void override(const VSDOptionalCharStyle &style)
{
@@ -246,6 +246,7 @@ struct VSDOptionalCharStyle
ASSIGN_OPTIONAL(style.smallcaps, smallcaps);
ASSIGN_OPTIONAL(style.superscript, superscript);
ASSIGN_OPTIONAL(style.subscript, subscript);
+ ASSIGN_OPTIONAL(style.scaleWidth, scaleWidth);
}
unsigned charCount;
@@ -263,6 +264,7 @@ struct VSDOptionalCharStyle
boost::optional<bool> smallcaps;
boost::optional<bool> superscript;
boost::optional<bool> subscript;
+ boost::optional<double> scaleWidth;
};
struct VSDCharStyle
@@ -270,17 +272,17 @@ struct VSDCharStyle
VSDCharStyle()
: charCount(0), font(), colour(), size(12.0/72.0), bold(false), italic(false), underline(false),
doubleunderline(false), strikeout(false), doublestrikeout(false), allcaps(false), initcaps(false),
- smallcaps(false), superscript(false), subscript(false) {}
+ smallcaps(false), superscript(false), subscript(false), scaleWidth(1.0) {}
VSDCharStyle(unsigned cc, const VSDName &ft, const Colour &c, double s, bool b, bool i, bool u, bool du,
- bool so, bool dso, bool ac, bool ic, bool sc, bool super, bool sub) :
+ bool so, bool dso, bool ac, bool ic, bool sc, bool super, bool sub, double sw) :
charCount(cc), font(ft), colour(c), size(s), bold(b), italic(i), underline(u), doubleunderline(du),
strikeout(so), doublestrikeout(dso), allcaps(ac), initcaps(ic), smallcaps(sc), superscript(super),
- subscript(sub) {}
+ subscript(sub), scaleWidth(sw) {}
VSDCharStyle(const VSDCharStyle &style) :
charCount(style.charCount), font(style.font), colour(style.colour), size(style.size), bold(style.bold),
italic(style.italic), underline(style.underline), doubleunderline(style.doubleunderline), strikeout(style.strikeout),
doublestrikeout(style.doublestrikeout), allcaps(style.allcaps), initcaps(style.initcaps), smallcaps(style.smallcaps),
- superscript(style.superscript), subscript(style.subscript) {}
+ superscript(style.superscript), subscript(style.subscript), scaleWidth(style.scaleWidth) {}
~VSDCharStyle() {}
void override(const VSDOptionalCharStyle &style)
{
@@ -298,6 +300,7 @@ struct VSDCharStyle
ASSIGN_OPTIONAL(style.smallcaps, smallcaps);
ASSIGN_OPTIONAL(style.superscript, superscript);
ASSIGN_OPTIONAL(style.subscript, subscript);
+ ASSIGN_OPTIONAL(style.scaleWidth, scaleWidth);
}
unsigned charCount;
@@ -315,6 +318,7 @@ struct VSDCharStyle
bool smallcaps;
bool superscript;
bool subscript;
+ double scaleWidth;
};
struct VSDOptionalParaStyle
diff --git a/src/lib/VSDStylesCollector.cpp b/src/lib/VSDStylesCollector.cpp
index 934b7c3..aaddc09 100644
--- a/src/lib/VSDStylesCollector.cpp
+++ b/src/lib/VSDStylesCollector.cpp
@@ -296,7 +296,7 @@ void libvisio::VSDStylesCollector::collectCharIX(unsigned /* id */, unsigned lev
const boost::optional<bool> & /* bold */, const boost::optional<bool> & /* italic */, const boost::optional<bool> & /* underline */,
const boost::optional<bool> & /* doubleunderline */, const boost::optional<bool> & /* strikeout */, const boost::optional<bool> & /* doublestrikeout */,
const boost::optional<bool> & /* allcaps */, const boost::optional<bool> & /* initcaps */, const boost::optional<bool> & /* smallcaps */,
- const boost::optional<bool> & /* superscript */, const boost::optional<bool> & /* subscript */)
+ const boost::optional<bool> & /* superscript */, const boost::optional<bool> & /* subscript */, const boost::optional<double> & /* scaleWidth */)
{
_handleLevelChange(level);
}
@@ -311,7 +311,7 @@ void libvisio::VSDStylesCollector::collectDefaultCharStyle(unsigned /* charCount
const boost::optional<bool> & /* bold */, const boost::optional<bool> & /* italic */, const boost::optional<bool> & /* underline */,
const boost::optional<bool> & /* doubleunderline */, const boost::optional<bool> & /* strikeout */, const boost::optional<bool> & /* doublestrikeout */,
const boost::optional<bool> & /* allcaps */, const boost::optional<bool> & /* initcaps */, const boost::optional<bool> & /* smallcaps */,
- const boost::optional<bool> & /* superscript */, const boost::optional<bool> & /* subscript */)
+ const boost::optional<bool> & /* superscript */, const boost::optional<bool> & /* subscript */, const boost::optional<double> & /* scaleWidth */)
{
}
@@ -371,7 +371,7 @@ void libvisio::VSDStylesCollector::collectCharIXStyle(unsigned /* id */, unsigne
const boost::optional<bool> & /* strikeout */, const boost::optional<bool> & /* doublestrikeout */,
const boost::optional<bool> & /* allcaps */, const boost::optional<bool> & /* initcaps */,
const boost::optional<bool> & /* smallcaps */, const boost::optional<bool> & /* superscript */,
- const boost::optional<bool> & /* subscript */)
+ const boost::optional<bool> & /* subscript */, const boost::optional<double> & /* scaleWidth */)
{
_handleLevelChange(level);
}
diff --git a/src/lib/VSDStylesCollector.h b/src/lib/VSDStylesCollector.h
index a619ad4..9e4534e 100644
--- a/src/lib/VSDStylesCollector.h
+++ b/src/lib/VSDStylesCollector.h
@@ -90,12 +90,13 @@ public:
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
- const boost::optional<bool> &subscript);
+ const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth);
void collectDefaultCharStyle(unsigned charCount, const boost::optional<VSDName> &font, const boost::optional<Colour> &fontColour,
const boost::optional<double> &fontSize, const boost::optional<bool> &bold, const boost::optional<bool> &italic,
const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout,
const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps,
- const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript, const boost::optional<bool> &subscript);
+ const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript, const boost::optional<bool> &subscript,
+ const boost::optional<double> &scaleWidth);
void collectParaIX(unsigned id, unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
const boost::optional<double> &indLeft, const boost::optional<double> &indRight, const boost::optional<double> &spLine,
const boost::optional<double> &spBefore, const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align,
@@ -142,7 +143,7 @@ public:
const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
- const boost::optional<bool> &subscript);
+ const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth);
void collectParaIXStyle(unsigned id, unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
const boost::optional<double> &indLeft, const boost::optional<double> &indRight, const boost::optional<double> &spLine,
const boost::optional<double> &spBefore, const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align,
diff --git a/src/lib/VSDXMLParserBase.cpp b/src/lib/VSDXMLParserBase.cpp
index 96b4a8e..7b9dbcb 100644
--- a/src/lib/VSDXMLParserBase.cpp
+++ b/src/lib/VSDXMLParserBase.cpp
@@ -1198,6 +1198,7 @@ void libvisio::VSDXMLParserBase::readCharIX(xmlTextReaderPtr reader)
boost::optional<bool> superscript;
boost::optional<bool> subscript;
boost::optional<double> fontSize;
+ boost::optional<double> scaleWidth;
do
{
@@ -1304,6 +1305,8 @@ void libvisio::VSDXMLParserBase::readCharIX(xmlTextReaderPtr reader)
}
break;
case XML_FONTSCALE:
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ ret = readDoubleData(scaleWidth, reader);
break;
case XML_SIZE:
if (XML_READER_TYPE_ELEMENT == tokenType)
@@ -1335,17 +1338,17 @@ void libvisio::VSDXMLParserBase::readCharIX(xmlTextReaderPtr reader)
if (m_isInStyles)
m_collector->collectCharIXStyle(ix, level, charCount, font, fontColour, fontSize, bold, italic,
underline, doubleunderline, strikeout, doublestrikeout, allcaps,
- initcaps, smallcaps, superscript, subscript);
+ initcaps, smallcaps, superscript, subscript, scaleWidth);
else
{
if (!ix || m_shape.m_charList.empty()) // character style 0 is the default character style
m_shape.m_charStyle.override(VSDOptionalCharStyle(charCount, font, fontColour, fontSize, bold,
italic, underline, doubleunderline, strikeout, doublestrikeout,
- allcaps, initcaps, smallcaps, superscript, subscript));
+ allcaps, initcaps, smallcaps, superscript, subscript, scaleWidth));
m_shape.m_charList.addCharIX(ix, level, charCount, font, fontColour, fontSize, bold, italic,
underline, doubleunderline, strikeout, doublestrikeout, allcaps,
- initcaps, smallcaps, superscript, subscript);
+ initcaps, smallcaps, superscript, subscript, scaleWidth);
}
}
@@ -1821,7 +1824,7 @@ void libvisio::VSDXMLParserBase::_flushShape()
m_shape.m_charStyle.size, m_shape.m_charStyle.bold, m_shape.m_charStyle.italic, m_shape.m_charStyle.underline,
m_shape.m_charStyle.doubleunderline, m_shape.m_charStyle.strikeout, m_shape.m_charStyle.doublestrikeout,
m_shape.m_charStyle.allcaps, m_shape.m_charStyle.initcaps, m_shape.m_charStyle.smallcaps,
- m_shape.m_charStyle.superscript, m_shape.m_charStyle.subscript);
+ m_shape.m_charStyle.superscript, m_shape.m_charStyle.subscript, m_shape.m_charStyle.scaleWidth);
m_shape.m_charList.handle(m_collector);