vcl/inc/pdf/pdfwriter_impl.hxx | 2 +- vcl/source/gdi/pdfwriter_impl.cxx | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-)
New commits: commit 506d969193822f396bb2203718124e3516ad75d1 Author: Khaled Hosny <[email protected]> AuthorDate: Sat Oct 29 11:12:23 2022 +0200 Commit: خالد حسني <[email protected]> CommitDate: Sat Oct 29 12:04:05 2022 +0200 vcl: check the correct face for color glyphs We were checking the presence of color glyphs on the base face which can potentially different from the actual face the glyphs are using (e.g. in case of glyph fallback). Also rename the functions so we don’t need overloading. Change-Id: I6f278ac7fa32182a7d8fb1cd2ef00f392ced1b9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142007 Tested-by: Jenkins Reviewed-by: خالد حسني <[email protected]> diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index 6102b64a8956..1459cf16e0d2 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -853,7 +853,7 @@ i12626 /* creates fonts and subsets that will be emitted later */ void registerGlyph(const sal_GlyphId, const vcl::font::PhysicalFontFace*, const std::vector<sal_Ucs>&, sal_Int32, sal_uInt8&, sal_Int32&); - void registerGlyph(const sal_GlyphId, const vcl::font::PhysicalFontFace*, const std::vector<sal_Ucs>&, sal_Int32, sal_uInt8&, sal_Int32&, bool); + void registerSimpleGlyph(const sal_GlyphId, const vcl::font::PhysicalFontFace*, const std::vector<sal_Ucs>&, sal_Int32, sal_uInt8&, sal_Int32&); /* emits a text object according to the passed layout */ /* TODO: remove rText as soon as SalLayout will change so that rText is not necessary anymore */ diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6214489203b3..6f096e52c154 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -4186,7 +4186,7 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( PDFWidget& rBox, const PDFW sal_uInt8 nMappedGlyph; sal_Int32 nMappedFontObject; - registerGlyph(nGlyphId, pDevFont, { cMark }, nGlyphWidth, nMappedGlyph, nMappedFontObject, pDevFont->IsColorFont()); + registerGlyph(nGlyphId, pDevFont, { cMark }, nGlyphWidth, nMappedGlyph, nMappedFontObject); appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetRadioCheckTextColor() ), aDA ); aDA.append( ' ' ); @@ -6083,7 +6083,7 @@ sal_Int32 PDFWriterImpl::getSystemFont( const vcl::Font& i_rFont ) return nFontID; } -void PDFWriterImpl::registerGlyph(const sal_GlyphId nFontGlyphId, +void PDFWriterImpl::registerSimpleGlyph(const sal_GlyphId nFontGlyphId, const vcl::font::PhysicalFontFace* pFont, const std::vector<sal_Ucs>& rCodeUnits, sal_Int32 nGlyphWidth, @@ -6130,10 +6130,9 @@ void PDFWriterImpl::registerGlyph(const sal_GlyphId nFontGlyphId, void PDFWriterImpl::registerGlyph(const sal_GlyphId nFontGlyphId, const vcl::font::PhysicalFontFace* pFace, const std::vector<sal_Ucs>& rCodeUnits, sal_Int32 nGlyphWidth, - sal_uInt8& nMappedGlyph, sal_Int32& nMappedFontObject, - bool bColor) + sal_uInt8& nMappedGlyph, sal_Int32& nMappedFontObject) { - if (bColor) + if (pFace->IsColorFont()) { // Font has colors, check if this glyph has color layers or bitmap. tools::Rectangle aRect; @@ -6178,8 +6177,8 @@ void PDFWriterImpl::registerGlyph(const sal_GlyphId nFontGlyphId, { sal_uInt8 nLayerGlyph; sal_Int32 nLayerFontID; - registerGlyph(aLayer.nGlyphIndex, pFace, rCodeUnits, nGlyphWidth, - nLayerGlyph, nLayerFontID); + registerSimpleGlyph(aLayer.nGlyphIndex, pFace, rCodeUnits, nGlyphWidth, + nLayerGlyph, nLayerFontID); rNewGlyphEmit.addColorLayer( { nLayerFontID, nLayerGlyph, aLayer.nColorIndex }); @@ -6198,7 +6197,8 @@ void PDFWriterImpl::registerGlyph(const sal_GlyphId nFontGlyphId, } // If we reach here then the glyph has no color layers. - registerGlyph(nFontGlyphId, pFace, rCodeUnits, nGlyphWidth, nMappedGlyph, nMappedFontObject); + registerSimpleGlyph(nFontGlyphId, pFace, rCodeUnits, nGlyphWidth, nMappedGlyph, + nMappedFontObject); } void PDFWriterImpl::drawRelief( SalLayout& rLayout, const OUString& rText, bool bTextLines ) @@ -6582,7 +6582,6 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool } FontMetric aRefDevFontMetric = GetFontMetric(); - const vcl::font::PhysicalFontFace* pDevFont = GetFontInstance()->GetFontFace(); const GlyphItem* pGlyph = nullptr; const LogicalFontInstance* pGlyphFont = nullptr; @@ -6646,7 +6645,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool sal_uInt8 nMappedGlyph; sal_Int32 nMappedFontObject; - registerGlyph(nGlyphId, pFace, aCodeUnits, nGlyphWidth, nMappedGlyph, nMappedFontObject, pDevFont->IsColorFont()); + registerGlyph(nGlyphId, pFace, aCodeUnits, nGlyphWidth, nMappedGlyph, nMappedFontObject); int nCharPos = -1; if (bUseActualText || pGlyph->IsInCluster())
