diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2019-12-10 13:43:16 +1100 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2019-12-18 03:11:57 +0100 |
commit | 7732444c5d4e79ae0218932afe85bcc4b56a00a4 (patch) | |
tree | 415519fa6e5b3cdddbb8ebe83e41b20a9b1b08b6 /drawinglayer | |
parent | 491e8f60bf7f216a3bb3092b22334924b6c9aee1 (diff) |
drawinglayer: improve logging for fonts
Change-Id: I5b430360894dc1738445820679ceaf09edfeef55
Reviewed-on: https://gerrit.libreoffice.org/84840
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/tools/emfpfont.cxx | 30 | ||||
-rw-r--r-- | drawinglayer/source/tools/emfpfont.hxx | 14 |
2 files changed, 37 insertions, 7 deletions
diff --git a/drawinglayer/source/tools/emfpfont.cxx b/drawinglayer/source/tools/emfpfont.cxx index d7b9daa0c46d..185b813540b2 100644 --- a/drawinglayer/source/tools/emfpfont.cxx +++ b/drawinglayer/source/tools/emfpfont.cxx @@ -22,6 +22,25 @@ namespace emfplushelper { + static OUString FontStyleToString(sal_uInt32 style) + { + OUString sStyle; + + if (style & FontStyleBold) + sStyle = "\n\t\t\tFontStyleBold"; + + if (style & FontStyleItalic) + sStyle = sStyle.concat("\n\t\t\tFontStyleItalic"); + + if (style & FontStyleUnderline) + sStyle = sStyle.concat("\n\t\t\tFontStyleUnderline"); + + if (style & FontStyleStrikeout) + sStyle = sStyle.concat("\n\t\t\tFontStyleStrikeout"); + + return sStyle; + } + void EMFPFont::Read(SvMemoryStream &s) { sal_uInt32 header; @@ -29,8 +48,13 @@ namespace emfplushelper sal_uInt32 length; s.ReadUInt32(header).ReadFloat(emSize).ReadUInt32(sizeUnit).ReadInt32(fontFlags).ReadUInt32(reserved).ReadUInt32(length); SAL_WARN_IF((header >> 12) != 0xdbc01, "drawinglayer", "Invalid header - not 0xdbc01"); - SAL_INFO("drawinglayer", "EMF+\tfont\nEMF+\theader: 0x" << std::hex << (header >> 12) << " version: 0x" << (header & 0x1fff) << " size: " << std::dec << emSize << " unit: 0x" << std::hex << sizeUnit << std::dec); - SAL_INFO("drawinglayer", "EMF+\tflags: 0x" << std::hex << fontFlags << " reserved: 0x" << reserved << " length: 0x" << std::hex << length << std::dec); + SAL_INFO("drawinglayer", "EMF+\tHeader: 0x" << std::hex << (header >> 12)); + SAL_INFO("drawinglayer", "EMF+\tVersion: 0x" << (header & 0x1fff)); + SAL_INFO("drawinglayer", "EMF+\tSize: " << std::dec << emSize); + SAL_INFO("drawinglayer", "EMF+\tUnit: " << UnitTypeToString(sizeUnit) << " (0x" << std::hex << sizeUnit << ")" << std::dec); + SAL_INFO("drawinglayer", "EMF+\tFlags: " << FontStyleToString(fontFlags) << " (0x" << std::hex << fontFlags << ")"); + SAL_INFO("drawinglayer", "EMF+\tReserved: 0x" << reserved << std::dec); + SAL_INFO("drawinglayer", "EMF+\tLength: " << length); //tdf#113624 Convert unit to Pixels emSize = emSize * EmfPlusHelperData::getUnitToPixelMultiplier(static_cast<UnitType>(sizeUnit)); @@ -46,7 +70,7 @@ namespace emfplushelper } family = OUString(pStr, SAL_NO_ACQUIRE); - SAL_INFO("drawinglayer", "EMF+\tfamily: " << family); + SAL_INFO("drawinglayer", "EMF+\tFamily: " << family); } } } diff --git a/drawinglayer/source/tools/emfpfont.hxx b/drawinglayer/source/tools/emfpfont.hxx index ce5760546e87..0559cb949487 100644 --- a/drawinglayer/source/tools/emfpfont.hxx +++ b/drawinglayer/source/tools/emfpfont.hxx @@ -24,6 +24,12 @@ namespace emfplushelper { + const sal_uInt32 FontStyleBold = 0x00000001; + const sal_uInt32 FontStyleItalic = 0x00000002; + const sal_uInt32 FontStyleUnderline = 0x00000004; + const sal_uInt32 FontStyleStrikeout = 0x00000008; + + struct EMFPFont : public EMFPObject { float emSize; @@ -33,10 +39,10 @@ namespace emfplushelper void Read(SvMemoryStream &s); - bool Bold() const { return fontFlags & 0x1; } - bool Italic() const { return fontFlags & 0x2; } - bool Underline() const { return fontFlags & 0x4; } - bool Strikeout() const { return fontFlags & 0x8; } + bool Bold() const { return fontFlags & FontStyleBold; } + bool Italic() const { return fontFlags & FontStyleItalic; } + bool Underline() const { return fontFlags & FontStyleUnderline; } + bool Strikeout() const { return fontFlags & FontStyleStrikeout; } }; } |