[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/skia
vcl/inc/quartz/salgdi.h| 10 -- vcl/quartz/AquaGraphicsBackend.cxx |2 +- vcl/skia/osx/gdiimpl.cxx |2 +- 3 files changed, 6 insertions(+), 8 deletions(-) New commits: commit 0ae1a8cd12187b1b7197782d30d91c6a0d56f608 Author: Stephan Bergmann AuthorDate: Wed Nov 30 17:31:20 2022 +0100 Commit: Stephan Bergmann CommitDate: Wed Nov 30 22:45:53 2022 +0100 Avoid a dynamic cross cast on macOS ...now causing > In file included from vcl/osx/a11ytextattributeswrapper.mm:23: > vcl/inc/quartz/salgdi.h:283:22: error: suspicious dynamic cross cast from 'AquaGraphicsBackendBase *' to 'SalGraphicsImpl *' [loplugin:crosscast] > mpImpl = dynamic_cast(this); > ^~~~ Change-Id: I0c9a4af0690c195c693f986e02284a48fe753a07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143505 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 8a0fc4cfd3f0..61ff01c12e3a 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -272,15 +272,10 @@ struct AquaSharedAttributes class AquaGraphicsBackendBase { public: -AquaGraphicsBackendBase(AquaSharedAttributes& rShared) -: mrShared( rShared ) -{} virtual ~AquaGraphicsBackendBase() = 0; AquaSharedAttributes& GetShared() { return mrShared; } SalGraphicsImpl* GetImpl() { -if(mpImpl == nullptr) -mpImpl = dynamic_cast(this); return mpImpl; } virtual void UpdateGeometryProvider(SalGeometryProvider*) {}; @@ -293,6 +288,9 @@ public: virtual void Flush() {} virtual void Flush( const tools::Rectangle& ) {} protected: +AquaGraphicsBackendBase(AquaSharedAttributes& rShared, SalGraphicsImpl * impl) +: mrShared( rShared ), mpImpl(impl) +{} static bool performDrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle , @@ -302,7 +300,7 @@ protected: AquaSalFrame* mpFrame); AquaSharedAttributes& mrShared; private: -SalGraphicsImpl* mpImpl = nullptr; +SalGraphicsImpl* mpImpl; }; inline AquaGraphicsBackendBase::~AquaGraphicsBackendBase() {} diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index aef2e3bb0f21..987ce5b784a5 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -190,7 +190,7 @@ void drawPattern50(void*, CGContextRef rContext) } AquaGraphicsBackend::AquaGraphicsBackend(AquaSharedAttributes& rShared) -: AquaGraphicsBackendBase(rShared) +: AquaGraphicsBackendBase(rShared, this) { } diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index 6d65eedd0ec4..38927e92c9ca 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -38,7 +38,7 @@ using namespace SkiaHelper; AquaSkiaSalGraphicsImpl::AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent, AquaSharedAttributes& rShared) : SkiaSalGraphicsImpl(rParent, rShared.mpFrame) -, AquaGraphicsBackendBase(rShared) +, AquaGraphicsBackendBase(rShared, this) { Init(); // mac code doesn't call Init() }
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/skia vcl/source vcl/unx
vcl/inc/font/LogicalFontInstance.hxx |3 +++ vcl/inc/quartz/salgdi.h|2 -- vcl/inc/unx/glyphcache.hxx |4 vcl/quartz/ctfonts.cxx | 17 ++--- vcl/quartz/salgdi.cxx |2 +- vcl/skia/osx/gdiimpl.cxx |2 +- vcl/skia/x11/textrender.cxx|4 ++-- vcl/source/font/LogicalFontInstance.cxx| 10 ++ vcl/source/gdi/impglyphitem.cxx|4 ++-- vcl/source/gdi/pdfwriter_impl.cxx | 11 ++- vcl/unx/generic/gdi/cairotextrender.cxx|4 ++-- vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 15 +-- vcl/unx/generic/print/genpspgraphics.cxx | 20 ++-- 13 files changed, 32 insertions(+), 66 deletions(-) New commits: commit d4005521e4fe4379381605b63af1950c5aecd798 Author: Khaled Hosny AuthorDate: Sun Nov 20 17:45:51 2022 +0200 Commit: خالد حسني CommitDate: Sun Nov 20 22:17:22 2022 +0100 vcl: add NeedsArtificialBold/Italic() to LogicalFontInstance Change-Id: Ie8bab5d7653a22d0f56b4c859fb2260d96e655c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142998 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/font/LogicalFontInstance.hxx b/vcl/inc/font/LogicalFontInstance.hxx index 8887a5d77a1d..0b40a9c7d4f7 100644 --- a/vcl/inc/font/LogicalFontInstance.hxx +++ b/vcl/inc/font/LogicalFontInstance.hxx @@ -112,6 +112,9 @@ public: // TODO: make data members private void GetScale(double* nXScale, double* nYScale) const; +bool NeedsArtificialItalic() const; +bool NeedsArtificialBold() const; + protected: explicit LogicalFontInstance(const vcl::font::PhysicalFontFace&, const vcl::font::FontSelectPattern&); diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 4812404bbc6e..8a0fc4cfd3f0 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -94,8 +94,6 @@ public: float mfFontStretch; /// text rotation in radian float mfFontRotation; -/// faux bold - true, if font doesn't have proper bold variants -bool mbFauxBold; private: explicit CoreTextFont(const CoreTextFontFace&, const vcl::font::FontSelectPattern&); diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index 22e2f0e173d9..9de7bd59fe6c 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -120,8 +120,6 @@ public: boolTestFont() const { return mbFaceOk;} FT_Face GetFtFace() const; const FontConfigFontOptions* GetFontOptions() const; -boolNeedsArtificialBold() const { return mbArtBold; } -boolNeedsArtificialItalic() const { return mbArtItalic; } voidGetFontMetric(ImplFontMetricDataRef const &) const; @@ -154,8 +152,6 @@ private: mutable std::unique_ptr mxFontOptions; boolmbFaceOk; -boolmbArtItalic; -boolmbArtBold; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 1f7be532db31..89460c3943a1 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -45,7 +45,6 @@ CoreTextFont::CoreTextFont(const CoreTextFontFace& rPFF, const vcl::font::FontSe : LogicalFontInstance(rPFF, rFSP) , mfFontStretch( 1.0 ) , mfFontRotation( 0.0 ) -, mbFauxBold(false) , mpCTFont(nullptr) { double fScaledFontHeight = rFSP.mfExactHeight; @@ -63,21 +62,9 @@ CoreTextFont::CoreTextFont(const CoreTextFontFace& rPFF, const vcl::font::FontSe aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMakeScale(mfFontStretch, 1.0F)); } -// fake bold -if ( (rFSP.GetWeight() >= WEIGHT_BOLD) && - ((rPFF.GetWeight() < WEIGHT_SEMIBOLD) && - (rPFF.GetWeight() != WEIGHT_DONTKNOW)) ) -{ -mbFauxBold = true; -} - -// fake italic -if (((rFSP.GetItalic() == ITALIC_NORMAL) || - (rFSP.GetItalic() == ITALIC_OBLIQUE)) && -(rPFF.GetItalic() == ITALIC_NONE)) -{ +// artificial italic +if (NeedsArtificialItalic()) aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, ARTIFICIAL_ITALIC_SKEW, 1, 0, 0)); -} CTFontDescriptorRef pFontDesc = rPFF.GetFontDescriptorRef(); mpCTFont = CTFontCreateWithFontDescriptor( pFontDesc, fScaledFontHeight, ); diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index a9f879dfea90..661a7e76735e 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -391,7 +391,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool b CGContextSetShouldAntialias(mrShared.maContextHolder.get(), !mrShared.mbNonAntialiasedText);
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/skia vcl/source vcl/unx
vcl/inc/font/LogicalFontInstance.hxx |4 vcl/quartz/ctfonts.cxx |2 +- vcl/skia/x11/textrender.cxx|2 +- vcl/source/gdi/pdfwriter_impl.cxx |2 +- vcl/unx/generic/gdi/cairotextrender.cxx|2 +- vcl/unx/generic/glyphs/freetype_glyphcache.cxx |4 ++-- 6 files changed, 10 insertions(+), 6 deletions(-) New commits: commit f88e7632b745a9b18af36cd901399c40e8b7378f Author: Khaled Hosny AuthorDate: Sat Nov 19 20:55:50 2022 +0200 Commit: خالد حسني CommitDate: Sun Nov 20 19:45:38 2022 +0100 vcl: unify skew for artificial italic Cairo, Skia, Core Text, and PDF all were using slightly different skew for artificial italic. On Windows, we don’t even apply the skew ourselves and let DirectWrite apply it. The value chosen here should be the same as the one applied by DirectWrite for consistency (measured manually, and confirmed against: https://source.winehq.org/git/wine.git/blob/5d1820c40bd93e6810f072a39745ee739ba99b81:/dlls/dwrite/freetype.c#l467) Change-Id: I3ab017b4cd7a3b4dba097cd302333a88e4c16350 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142980 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/font/LogicalFontInstance.hxx b/vcl/inc/font/LogicalFontInstance.hxx index 21c09dbafca0..8887a5d77a1d 100644 --- a/vcl/inc/font/LogicalFontInstance.hxx +++ b/vcl/inc/font/LogicalFontInstance.hxx @@ -42,6 +42,10 @@ class ConvertChar; class ImplFontCache; +constexpr float ARTIFICIAL_ITALIC_MATRIX_XX = 1 << 16; +constexpr float ARTIFICIAL_ITALIC_MATRIX_XY = (1 << 16) / 3.f; +constexpr float ARTIFICIAL_ITALIC_SKEW = ARTIFICIAL_ITALIC_MATRIX_XY / ARTIFICIAL_ITALIC_MATRIX_XX; + // extend std namespace to add custom hash needed for LogicalFontInstance namespace std diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 92fd35fa2cee..1f7be532db31 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -76,7 +76,7 @@ CoreTextFont::CoreTextFont(const CoreTextFontFace& rPFF, const vcl::font::FontSe (rFSP.GetItalic() == ITALIC_OBLIQUE)) && (rPFF.GetItalic() == ITALIC_NONE)) { -aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, basegfx::deg2rad(12), 1, 0, 0)); +aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, ARTIFICIAL_ITALIC_SKEW, 1, 0, 0)); } CTFontDescriptorRef pFontDesc = rPFF.GetFontDescriptorRef(); diff --git a/vcl/skia/x11/textrender.cxx b/vcl/skia/x11/textrender.cxx index 153551e12ddd..c97e2b6cf3cb 100644 --- a/vcl/skia/x11/textrender.cxx +++ b/vcl/skia/x11/textrender.cxx @@ -51,7 +51,7 @@ void SkiaTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalGr font.setSize(nHeight); font.setScaleX(1.0 * nWidth / nHeight); if (rFont.NeedsArtificialItalic()) -font.setSkewX(1.0 * -0x4000L / 0x1L); +font.setSkewX(-1.0 * ARTIFICIAL_ITALIC_SKEW); if (rFont.NeedsArtificialBold()) font.setEmbolden(true); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b95898f4b2bc..8db18ef6a6ad 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6504,7 +6504,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool GetFontInstance()->GetFontFace()->GetItalic() != ITALIC_OBLIQUE ) ) { -fSkew = M_PI/12.0; +fSkew = ARTIFICIAL_ITALIC_SKEW; } // if the mapmode is distorted we need to adjust for that also diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 6f462b4e3377..81d3b532c12a 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -344,7 +344,7 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG { cairo_matrix_t shear; cairo_matrix_init_identity(); -shear.xy = -shear.xx * 0x6000L / 0x1L; +shear.xy = -shear.xx * ARTIFICIAL_ITALIC_SKEW; cairo_matrix_multiply(, , ); } diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 4cc30ea3c21a..d4a50b0f0167 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -858,8 +858,8 @@ bool FreetypeFont::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rB2 if( mbArtItalic ) { FT_Matrix aMatrix; -aMatrix.xx = aMatrix.yy = 0x1L; -aMatrix.xy = 0x6000L; +aMatrix.xx = aMatrix.yy = ARTIFICIAL_ITALIC_MATRIX_XX; +aMatrix.xy = ARTIFICIAL_ITALIC_MATRIX_XY; aMatrix.yx = 0; FT_Glyph_Transform( pGlyphFT, , nullptr ); }
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/skia vcl/source vcl/unx vcl/win
vcl/inc/font/PhysicalFontFace.hxx |2 vcl/inc/quartz/salgdi.h|2 vcl/inc/unx/freetype_glyphcache.hxx|2 vcl/inc/win/salgdi.h |4 - vcl/inc/win/winlayout.hxx |3 + vcl/quartz/ctfonts.cxx |2 vcl/skia/win/gdiimpl.cxx |2 vcl/source/font/LogicalFontInstance.cxx|2 vcl/source/font/PhysicalFontFace.cxx |2 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |2 vcl/win/gdi/DWriteTextRenderer.cxx |2 vcl/win/gdi/salfont.cxx| 63 + 12 files changed, 47 insertions(+), 41 deletions(-) New commits: commit 64d4275b60d50a87fb2bf4dd45be3c28902cec52 Author: Khaled Hosny AuthorDate: Sun Nov 20 02:34:26 2022 +0200 Commit: خالد حسني CommitDate: Sun Nov 20 02:35:17 2022 +0100 vcl: fix artificial bold and italic on Windows Move creating DWFontFace to WinFontInstance so that it get proper font synthesis settings. Regression from: commit a80239ede3236c84d7a05d0fbc0f299811fee6c0 Author: Khaled Hosny Date: Sat Nov 19 03:03:15 2022 +0200 vcl: move creating DWFontFace to WinFontFace Change-Id: Ifba947d8908a37972d723028258500b10ec24cd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142982 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx index 6e99ae4a098c..96f2533f22fe 100644 --- a/vcl/inc/font/PhysicalFontFace.hxx +++ b/vcl/inc/font/PhysicalFontFace.hxx @@ -194,7 +194,7 @@ public: return nullptr; } -virtual const std::vector& GetVariations() const; +virtual const std::vector& GetVariations(const LogicalFontInstance&) const; protected: mutable hb_face_t* mpHbFace; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 79ea9e32e0d6..4812404bbc6e 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -72,7 +72,7 @@ public: hb_blob_t* GetHbTable(hb_tag_t nTag) const override; -const std::vector& GetVariations() const override; +const std::vector& GetVariations(const LogicalFontInstance&) const override; private: CTFontDescriptorRef mxFontDescriptor; diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx index 4cf982c50a12..5bc1632ccee6 100644 --- a/vcl/inc/unx/freetype_glyphcache.hxx +++ b/vcl/inc/unx/freetype_glyphcache.hxx @@ -101,7 +101,7 @@ public: virtual hb_face_t* GetHbFace() const override; virtual hb_blob_t* GetHbTable(hb_tag_t nTag) const override; -const std::vector& GetVariations() const override; +const std::vector& GetVariations(const LogicalFontInstance&) const override; }; class SAL_DLLPUBLIC_RTTI FreetypeFontInstance final : public LogicalFontInstance diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 999bb39a1812..f26f1d40f0c9 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -72,11 +72,9 @@ public: BYTEGetCharSet() const { return meWinCharSet; } BYTEGetPitchAndFamily() const { return mnPitchAndFamily; } -IDWriteFontFace*GetDWFontFace() const; - hb_blob_t* GetHbTable(hb_tag_t nTag) const override; -const std::vector& GetVariations() const override; +const std::vector& GetVariations(const LogicalFontInstance&) const override; private: sal_IntPtr mnId; diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index 702bf7bf0b2a..fb8e5a1c6e43 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -54,6 +54,8 @@ public: bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; +IDWriteFontFace* GetDWFontFace() const; + private: explicit WinFontInstance(const WinFontFace&, const vcl::font::FontSelectPattern&); @@ -65,6 +67,7 @@ private: float m_fScale; bool m_bIsCJKVerticalFont; sal_Int32 m_nTmDescent; +mutable sal::systools::COMReference mxDWFontFace; }; class TextOutRenderer diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index c2f6a8a55c00..92fd35fa2cee 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -268,7 +268,7 @@ hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const return pBlob; } -const std::vector& CoreTextFontFace::GetVariations() const +const std::vector& CoreTextFontFace::GetVariations(const LogicalFontInstance&) const { CTFontRef pFont = CTFontCreateWithFontDescriptor(mxFontDescriptor, 0.0, nullptr); diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index a9df26cb53a1..d063b440cf31 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -135,7 +135,7 @@
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/font/PhysicalFontFace.hxx |9 +++ vcl/inc/quartz/salgdi.h|2 - vcl/inc/unx/freetype_glyphcache.hxx|2 - vcl/inc/unx/glyphcache.hxx |2 - vcl/inc/win/salgdi.h |2 - vcl/quartz/ctfonts.cxx |9 --- vcl/source/font/PhysicalFontFace.cxx | 30 +++-- vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 17 +++--- vcl/win/gdi/salfont.cxx| 11 + 9 files changed, 46 insertions(+), 38 deletions(-) New commits: commit a38bb773bb568ef942293f23d0701da933817e8f Author: Khaled Hosny AuthorDate: Sat Nov 19 14:58:40 2022 +0200 Commit: خالد حسني CommitDate: Sat Nov 19 15:45:21 2022 +0100 vcl: use std::optional in PhysicalFontFace Otherwise when a font does not, say, support variations or color palettes, we keep querying the font each time they are requested. Change-Id: I3a41bc73dd814b25af3a8b5b009632ecf7ef27ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142963 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx index ae0e6ad7d5bf..6e99ae4a098c 100644 --- a/vcl/inc/font/PhysicalFontFace.hxx +++ b/vcl/inc/font/PhysicalFontFace.hxx @@ -194,16 +194,15 @@ public: return nullptr; } -virtual std::vector GetVariations() const { return {}; }; +virtual const std::vector& GetVariations() const; protected: mutable hb_face_t* mpHbFace; mutable hb_font_t* mpHbUnscaledFont; mutable FontCharMapRef mxCharMap; -mutable vcl::FontCapabilities maFontCapabilities; -mutable bool mbFontCapabilitiesRead; -mutable std::vector maColorPalettes; -mutable std::vector m_aVariations; +mutable std::optional mxFontCapabilities; +mutable std::optional> mxColorPalettes; +mutable std::optional> mxVariations; explicit PhysicalFontFace(const FontAttributes&); diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 121aef3cf59a..79ea9e32e0d6 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -72,7 +72,7 @@ public: hb_blob_t* GetHbTable(hb_tag_t nTag) const override; -std::vector GetVariations() const override; +const std::vector& GetVariations() const override; private: CTFontDescriptorRef mxFontDescriptor; diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx index 0ec53c073006..4cf982c50a12 100644 --- a/vcl/inc/unx/freetype_glyphcache.hxx +++ b/vcl/inc/unx/freetype_glyphcache.hxx @@ -101,7 +101,7 @@ public: virtual hb_face_t* GetHbFace() const override; virtual hb_blob_t* GetHbTable(hb_tag_t nTag) const override; -std::vector GetVariations() const override; +const std::vector& GetVariations() const override; }; class SAL_DLLPUBLIC_RTTI FreetypeFontInstance final : public LogicalFontInstance diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index a6be9e872da6..22e2f0e173d9 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -129,8 +129,6 @@ public: boolGetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const; boolGetAntialiasAdvice() const; -std::vector GetVariations() const; - private: friend class FreetypeFontInstance; friend class FreetypeManager; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index e0661dec5a1c..999bb39a1812 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -76,7 +76,7 @@ public: hb_blob_t* GetHbTable(hb_tag_t nTag) const override; -std::vector GetVariations() const override; +const std::vector& GetVariations() const override; private: sal_IntPtr mnId; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 0ca4ffc953ec..c2f6a8a55c00 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -268,12 +268,13 @@ hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const return pBlob; } -std::vector CoreTextFontFace::GetVariations() const +const std::vector& CoreTextFontFace::GetVariations() const { CTFontRef pFont = CTFontCreateWithFontDescriptor(mxFontDescriptor, 0.0, nullptr); -if (m_aVariations.empty()) +if (!mxVariations) { +mxVariations.emplace(); CFArrayRef pAxes = CTFontCopyVariationAxes(pFont); if (pAxes) { @@ -300,7 +301,7 @@ std::vector CoreTextFontFace::GetVariations() const continue; CFNumberGetValue(pValue, kCFNumberFloatType, ); -m_aVariations.push_back({ nTag, fValue }); +mxVariations->push_back({ nTag, fValue }); } }
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |6 +++--- vcl/quartz/ctfonts.cxx |3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) New commits: commit 35eaff1ad0490b0a1133a594041a6726e5844bd4 Author: Khaled Hosny AuthorDate: Sun Nov 6 00:07:15 2022 +0200 Commit: خالد حسني CommitDate: Sun Nov 6 16:53:08 2022 +0100 vcl: cleanup CoreTextFontFace() a bit Change-Id: Idcef772802636efab7e7b92415a6d31fec0ba979 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142348 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index f3bab610f08b..121aef3cf59a 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -58,11 +58,11 @@ class FontAttributes; class XorEmulation; // CoreText-specific physically available font face -class CoreTextFontFace : public vcl::font::PhysicalFontFace +class CoreTextFontFace final : public vcl::font::PhysicalFontFace { public: CoreTextFontFace( const FontAttributes&, CTFontDescriptorRef xRef ); -virtual ~CoreTextFontFace() override; +~CoreTextFontFace() override; sal_IntPtr GetFontId() const override; @@ -70,7 +70,7 @@ public: rtl::Reference CreateFontInstance(const vcl::font::FontSelectPattern&) const override; -virtual hb_blob_t* GetHbTable(hb_tag_t nTag) const override; +hb_blob_t* GetHbTable(hb_tag_t nTag) const override; std::vector GetVariations() const override; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index f75f8c4c3406..0ca4ffc953ec 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -218,8 +218,7 @@ bool CoreTextFont::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rRe hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const { hb_blob_t* pBlob = nullptr; -CTFontDescriptorRef pFontDesc = reinterpret_cast(GetFontId()); -CTFontRef pFont = CTFontCreateWithFontDescriptor(pFontDesc, 0.0, nullptr); +CTFontRef pFont = CTFontCreateWithFontDescriptor(mxFontDescriptor, 0.0, nullptr); if (!nTag) {
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx
vcl/inc/font/PhysicalFontFace.hxx |3 + vcl/inc/quartz/salgdi.h|5 - vcl/inc/unx/freetype_glyphcache.hxx|3 - vcl/inc/unx/glyphcache.hxx |2 vcl/quartz/ctfonts.cxx | 68 - vcl/source/font/LogicalFontInstance.cxx|9 ++- vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 53 ++- vcl/unx/generic/glyphs/glyphcache.cxx |6 -- 8 files changed, 79 insertions(+), 70 deletions(-) New commits: commit 643fec7cf7a81bf8c89a8efd47c0310b38f9076c Author: Khaled Hosny AuthorDate: Sat Oct 29 20:17:35 2022 +0200 Commit: خالد حسني CommitDate: Wed Nov 2 23:06:46 2022 +0100 vcl: add PhysicalFontFace::GetVariations() Use it to set the variations on hb_font_t, and we will use it for other things in later commits. Change-Id: Iae1861f74b38af4921ac97c1facecf0d4815c201 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142024 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx index 3d7fa0cba71d..ae0e6ad7d5bf 100644 --- a/vcl/inc/font/PhysicalFontFace.hxx +++ b/vcl/inc/font/PhysicalFontFace.hxx @@ -194,6 +194,8 @@ public: return nullptr; } +virtual std::vector GetVariations() const { return {}; }; + protected: mutable hb_face_t* mpHbFace; mutable hb_font_t* mpHbUnscaledFont; @@ -201,6 +203,7 @@ protected: mutable vcl::FontCapabilities maFontCapabilities; mutable bool mbFontCapabilitiesRead; mutable std::vector maColorPalettes; +mutable std::vector m_aVariations; explicit PhysicalFontFace(const FontAttributes&); diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index b621e715ef54..f3bab610f08b 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -72,6 +72,8 @@ public: virtual hb_blob_t* GetHbTable(hb_tag_t nTag) const override; +std::vector GetVariations() const override; + private: CTFontDescriptorRef mxFontDescriptor; }; @@ -98,11 +100,8 @@ public: private: explicit CoreTextFont(const CoreTextFontFace&, const vcl::font::FontSelectPattern&); -virtual void ImplInitHbFont(hb_font_t*) override; bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; -void SetFontVariationsOnHBFont(hb_font_t*) const; - CTFontRef mpCTFont; }; diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx index ca35beccc211..0ec53c073006 100644 --- a/vcl/inc/unx/freetype_glyphcache.hxx +++ b/vcl/inc/unx/freetype_glyphcache.hxx @@ -100,6 +100,8 @@ public: virtual hb_face_t* GetHbFace() const override; virtual hb_blob_t* GetHbTable(hb_tag_t nTag) const override; + +std::vector GetVariations() const override; }; class SAL_DLLPUBLIC_RTTI FreetypeFontInstance final : public LogicalFontInstance @@ -108,7 +110,6 @@ class SAL_DLLPUBLIC_RTTI FreetypeFontInstance final : public LogicalFontInstance std::unique_ptr mxFreetypeFont; -virtual void ImplInitHbFont(hb_font_t*) override; virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; explicit FreetypeFontInstance(const vcl::font::PhysicalFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP); diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index f6f885badbf3..a6be9e872da6 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -129,7 +129,7 @@ public: boolGetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const; boolGetAntialiasAdvice() const; -voidSetFontVariationsOnHBFont(hb_font_t* pHbFace) const; +std::vector GetVariations() const; private: friend class FreetypeFontInstance; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 9a2e2ab4ee69..0adc0bbfef39 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -269,49 +269,49 @@ hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const return pBlob; } -void CoreTextFont::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const +std::vector CoreTextFontFace::GetVariations() const { +CTFontRef pFont = CTFontCreateWithFontDescriptor(mxFontDescriptor, 0.0, nullptr); -CFArrayRef pAxes = CTFontCopyVariationAxes(mpCTFont); -if (!pAxes) -return; - -CFDictionaryRef pVariations = CTFontCopyVariation(mpCTFont); -std::vector aHBVariations; -if (pVariations) +if (m_aVariations.empty()) { -CFIndex nAxes = CFArrayGetCount(pAxes); -for (CFIndex i = 0; i < nAxes; ++i) +CFArrayRef pAxes = CTFontCopyVariationAxes(pFont); +if (pAxes) { -auto pAxis = static_cast(CFArrayGetValueAtIndex(pAxes, i)); -if (pAxis)
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |2 -- vcl/quartz/ctfonts.cxx | 48 +++- 2 files changed, 15 insertions(+), 35 deletions(-) New commits: commit 26bac421905b53580154c9cf3d567a5f13786c67 Author: Khaled Hosny AuthorDate: Sat Oct 29 12:33:41 2022 +0200 Commit: خالد حسني CommitDate: Sat Oct 29 16:15:19 2022 +0200 vcl: fold CoreTextFontFace::GetFonTtable into its only user Change-Id: I3201add2e10d9cf01fc48b8d934822fc7b1941d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142012 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index a0e00c6c2af2..b621e715ef54 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -68,8 +68,6 @@ public: CTFontDescriptorRef GetFontDescriptorRef() const { return mxFontDescriptor; } -int GetFontTable( uint32_t nTagCode, unsigned char* ) const; - rtl::Reference CreateFontInstance(const vcl::font::FontSelectPattern&) const override; virtual hb_blob_t* GetHbTable(hb_tag_t nTag) const override; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 81ab7a6ad2dc..861c57fa1ba9 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -218,13 +218,13 @@ bool CoreTextFont::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rRe hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const { hb_blob_t* pBlob = nullptr; +CTFontDescriptorRef pFontDesc = reinterpret_cast(GetFontId()); if (!nTag) { // If nTag is 0, the whole font data is requested. CoreText does not // give us that, so we will construct an HarfBuzz face from CoreText // table data and return the blob of that face. -auto pFontDesc = reinterpret_cast(GetFontId()); auto rCTFont = CTFontCreateWithFontDescriptor(pFontDesc, 0.0, nullptr); auto pTags = CTFontCopyAvailableTables(rCTFont, kCTFontTableOptionNoOptions); @@ -252,18 +252,24 @@ hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const return pBlob; } -sal_uLong nLength = 0; -unsigned char* pBuffer = nullptr; -nLength = GetFontTable(nTag, nullptr); +CTFontRef pFont = CTFontCreateWithFontDescriptor(pFontDesc, 0.0, nullptr); +CFDataRef pData = CTFontCopyTable(pFont, nTag, kCTFontTableOptionNoOptions); + +const CFIndex nLength = pData ? CFDataGetLength(pData) : 0; if (nLength > 0) { -pBuffer = new unsigned char[nLength]; -GetFontTable(nTag, pBuffer); +auto pBuffer = new UInt8[nLength]; +const CFRange aRange = CFRangeMake(0, nLength); +CFDataGetBytes(pData, aRange, pBuffer); + +pBlob = hb_blob_create(reinterpret_cast(pBuffer), nLength, + HB_MEMORY_MODE_READONLY, pBuffer, + [](void* data) { delete[] static_cast(data); }); } +if (pData) +CFRelease(pData); +CFRelease(pFont); -if (pBuffer != nullptr) -pBlob = hb_blob_create(reinterpret_cast(pBuffer), nLength, HB_MEMORY_MODE_READONLY, - pBuffer, [](void* data){ delete[] static_cast(data); }); return pBlob; } @@ -317,30 +323,6 @@ rtl::Reference CoreTextFontFace::CreateFontInstance(const v return new CoreTextFont(*this, rFSD); } -int CoreTextFontFace::GetFontTable(uint32_t nTagCode, unsigned char* pResultBuf ) const -{ -// get the raw table length -CTFontDescriptorRef pFontDesc = reinterpret_cast( GetFontId()); -CTFontRef rCTFont = CTFontCreateWithFontDescriptor( pFontDesc, 0.0, nullptr); -CFDataRef pDataRef = CTFontCopyTable(rCTFont, nTagCode, kCTFontTableOptionNoOptions); -CFRelease( rCTFont); -if( !pDataRef) -return 0; - -const CFIndex nByteLength = CFDataGetLength( pDataRef); - -// get the raw table data if requested -if( pResultBuf && (nByteLength > 0)) -{ -const CFRange aFullRange = CFRangeMake( 0, nByteLength); -CFDataGetBytes( pDataRef, aFullRange, reinterpret_cast(pResultBuf)); -} - -CFRelease( pDataRef); - -return static_cast(nByteLength); -} - FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFontEnabled ) { // all CoreText fonts are device fonts that can rotate just fine
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/skia
vcl/inc/quartz/salgdi.h |5 ++--- vcl/quartz/ctfonts.cxx | 39 ++- vcl/quartz/salgdi.cxx|9 - vcl/skia/osx/gdiimpl.cxx |4 +--- 4 files changed, 17 insertions(+), 40 deletions(-) New commits: commit 8ca507a619313ead970ad03a71416dcebea91405 Author: Khaled Hosny AuthorDate: Sat Oct 29 11:57:33 2022 +0200 Commit: خالد حسني CommitDate: Sat Oct 29 13:50:28 2022 +0200 vcl: simplify how CoreTextFont stores CTFontRef We create CFMutableDictionaryRef, store two items in it and only even access one of them. Simplify the whole thing and skip the middleman. Change-Id: Iefc6b2c2664b0ea92e231195390ce8cd0d8d9778 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142011 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 8e54fa65aa53..a0e00c6c2af2 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -88,7 +88,7 @@ public: void GetFontMetric( ImplFontMetricDataRef const & ); bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; -CFMutableDictionaryRef GetStyleDict( void ) const { return mpStyleDict; } +CTFontRef GetCTFont() const { return mpCTFont; } /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0 float mfFontStretch; @@ -105,8 +105,7 @@ private: void SetFontVariationsOnHBFont(hb_font_t*) const; -/// CoreText text style object -CFMutableDictionaryRef mpStyleDict; +CTFontRef mpCTFont; }; // TODO: move into cross-platform headers diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 25a7efe46e2a..81ab7a6ad2dc 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -46,7 +46,7 @@ CoreTextFont::CoreTextFont(const CoreTextFontFace& rPFF, const vcl::font::FontSe , mfFontStretch( 1.0 ) , mfFontRotation( 0.0 ) , mbFauxBold(false) -, mpStyleDict( nullptr ) +, mpCTFont(nullptr) { double fScaledFontHeight = rFSP.mfExactHeight; @@ -63,15 +63,6 @@ CoreTextFont::CoreTextFont(const CoreTextFontFace& rPFF, const vcl::font::FontSe aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMakeScale(mfFontStretch, 1.0F)); } -// create the style object for CoreText font attributes -static const CFIndex nMaxDictSize = 16; // TODO: does this really suffice? -mpStyleDict = CFDictionaryCreateMutable( nullptr, nMaxDictSize, - , - ); - -CFBooleanRef pCFVertBool = rFSP.mbVertical ? kCFBooleanTrue : kCFBooleanFalse; -CFDictionarySetValue( mpStyleDict, kCTVerticalFormsAttributeName, pCFVertBool ); - // fake bold if ( (rFSP.GetWeight() >= WEIGHT_BOLD) && ((rPFF.GetWeight() < WEIGHT_SEMIBOLD) && @@ -89,30 +80,24 @@ CoreTextFont::CoreTextFont(const CoreTextFontFace& rPFF, const vcl::font::FontSe } CTFontDescriptorRef pFontDesc = rPFF.GetFontDescriptorRef(); -CTFontRef pNewCTFont = CTFontCreateWithFontDescriptor( pFontDesc, fScaledFontHeight, ); -CFDictionarySetValue( mpStyleDict, kCTFontAttributeName, pNewCTFont ); -CFRelease( pNewCTFont); +mpCTFont = CTFontCreateWithFontDescriptor( pFontDesc, fScaledFontHeight, ); } CoreTextFont::~CoreTextFont() { -if( mpStyleDict ) -CFRelease( mpStyleDict ); +if (mpCTFont) +CFRelease(mpCTFont); } void CoreTextFont::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) { -// get the matching CoreText font handle -// TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here? -CTFontRef aCTFontRef = static_cast(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); - rxFontMetric->ImplCalcLineSpacing(this); rxFontMetric->ImplInitBaselines(this); // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts // setting this width to the pixel height of the fontsize is good enough // it also makes the calculation of the stretch factor simple -rxFontMetric->SetWidth( lrint( CTFontGetSize( aCTFontRef ) * mfFontStretch) ); +rxFontMetric->SetWidth( lrint( CTFontGetSize(mpCTFont) * mfFontStretch) ); rxFontMetric->SetMinKashida(GetKashidaWidth()); } @@ -120,12 +105,11 @@ void CoreTextFont::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) bool CoreTextFont::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bVertical) const { CGGlyph nCGGlyph = nId; -CTFontRef aCTFontRef = static_cast(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.11 kCTFontDefaultOrientation const CTFontOrientation aFontOrientation = kCTFontDefaultOrientation; // TODO: horz/vert SAL_WNODEPRECATED_DECLARATIONS_POP -CGRect aCGRect =
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/skia
vcl/inc/quartz/salgdi.h |8 +++ vcl/quartz/ctfonts.cxx | 16 +++--- vcl/quartz/salgdi.cxx| 52 +++ vcl/skia/osx/gdiimpl.cxx | 10 - 4 files changed, 43 insertions(+), 43 deletions(-) New commits: commit 37d6dbd1b8f90604d58a782f7af0af1d5c8c1f89 Author: Khaled Hosny AuthorDate: Sat Oct 29 11:37:06 2022 +0200 Commit: خالد حسني CommitDate: Sat Oct 29 13:49:26 2022 +0200 vcl: rename CoreTextStyle to CoreTextFont Everywhere else we call them fonts. Change-Id: I70ef5957e9fb4fd03588cf23a255480ad021e083 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142010 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 5d2611f5b06e..8e54fa65aa53 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -78,12 +78,12 @@ private: CTFontDescriptorRef mxFontDescriptor; }; -class CoreTextStyle final : public LogicalFontInstance +class CoreTextFont final : public LogicalFontInstance { friend rtl::Reference CoreTextFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; public: -~CoreTextStyle() override; +~CoreTextFont() override; void GetFontMetric( ImplFontMetricDataRef const & ); bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; @@ -98,7 +98,7 @@ public: bool mbFauxBold; private: -explicit CoreTextStyle(const CoreTextFontFace&, const vcl::font::FontSelectPattern&); +explicit CoreTextFont(const CoreTextFontFace&, const vcl::font::FontSelectPattern&); virtual void ImplInitHbFont(hb_font_t*) override; bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; @@ -459,7 +459,7 @@ class AquaSalGraphics : public SalGraphicsAutoDelegateToImpl sal_Int32 mnRealDPIY; // Device Font settings -rtl::Reference mpTextStyle[MAX_FALLBACK]; +rtl::ReferencempFont[MAX_FALLBACK]; public: AquaSalGraphics(); diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 298a5274aa1f..25a7efe46e2a 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -41,7 +41,7 @@ #include #include -CoreTextStyle::CoreTextStyle(const CoreTextFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP) +CoreTextFont::CoreTextFont(const CoreTextFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP) : LogicalFontInstance(rPFF, rFSP) , mfFontStretch( 1.0 ) , mfFontRotation( 0.0 ) @@ -94,13 +94,13 @@ CoreTextStyle::CoreTextStyle(const CoreTextFontFace& rPFF, const vcl::font::Font CFRelease( pNewCTFont); } -CoreTextStyle::~CoreTextStyle() +CoreTextFont::~CoreTextFont() { if( mpStyleDict ) CFRelease( mpStyleDict ); } -void CoreTextStyle::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) +void CoreTextFont::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) { // get the matching CoreText font handle // TODO: is it worth it to cache the CTFontRef in SetFont() and reuse it here? @@ -117,7 +117,7 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) rxFontMetric->SetMinKashida(GetKashidaWidth()); } -bool CoreTextStyle::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bVertical) const +bool CoreTextFont::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bVertical) const { CGGlyph nCGGlyph = nId; CTFontRef aCTFontRef = static_cast(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); @@ -195,7 +195,7 @@ static void MyCGPathApplierFunc( void* pData, const CGPathElement* pElement ) } } -bool CoreTextStyle::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rResult, bool) const +bool CoreTextFont::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rResult, bool) const { rResult.clear(); @@ -284,7 +284,7 @@ hb_blob_t* CoreTextFontFace::GetHbTable(hb_tag_t nTag) const return pBlob; } -void CoreTextStyle::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const +void CoreTextFont::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const { CTFontRef aCTFontRef = static_cast(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); @@ -326,14 +326,14 @@ void CoreTextStyle::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const hb_font_set_variations(pHbFont, aHBVariations.data(), aHBVariations.size()); } -void CoreTextStyle::ImplInitHbFont(hb_font_t* pHbFont) +void CoreTextFont::ImplInitHbFont(hb_font_t* pHbFont) { SetFontVariationsOnHBFont(pHbFont); } rtl::Reference CoreTextFontFace::CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const { -return new CoreTextStyle(*this, rFSD); +return new CoreTextFont(*this, rFSD); } int
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |6 - vcl/quartz/ctfonts.cxx |9 -- vcl/quartz/salgdi.cxx | 215 3 files changed, 230 deletions(-) New commits: commit c107d08460938270cbc2a32a89d995fc0ae8ebea Author: Khaled Hosny AuthorDate: Sat Oct 1 07:45:32 2022 +0200 Commit: خالد حسني CommitDate: Sat Oct 1 13:09:23 2022 +0200 vcl: Remove unused AquaSalGraphics::GetRawFontData() It was used for subsetting, but we switched subsetting to a more generic code path a while ago. Change-Id: I6066b7697268e9444587d73810f9465488aa4740 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140825 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 4435e9fd86c9..ec63592431e3 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -67,7 +67,6 @@ public: sal_IntPtr GetFontId() const override; int GetFontTable( uint32_t nTagCode, unsigned char* ) const; -int GetFontTable( const char pTagName[5], unsigned char* ) const; rtl::Reference CreateFontInstance(const vcl::font::FontSelectPattern&) const override; @@ -552,11 +551,6 @@ public: virtual SystemGraphicsData GetGraphicsData() const override; - -private: -static bool GetRawFontData( const vcl::font::PhysicalFontFace* pFontData, -std::vector& rBuffer, -bool* pJustCFF ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 83412955c0a4..9166d323f7dd 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -302,15 +302,6 @@ rtl::Reference CoreTextFontFace::CreateFontInstance(const v return new CoreTextStyle(*this, rFSD); } -int CoreTextFontFace::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const -{ -SAL_WARN_IF( pTagName[4]!='\0', "vcl", "CoreTextFontFace::GetFontTable with invalid tagname!" ); - -const CTFontTableTag nTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) + (pTagName[2]<<8) + (pTagName[3]<<0); - -return GetFontTable(nTagCode, pResultBuf); -} - int CoreTextFontFace::GetFontTable(uint32_t nTagCode, unsigned char* pResultBuf ) const { // get the raw table length diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index e27b2f1c2c32..7267e1a83cad 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -484,221 +484,6 @@ bool AquaSalGraphics::GetFontCapabilities(vcl::FontCapabilities return mpTextStyle[0]->GetFontFace()->GetFontCapabilities(rFontCapabilities); } -// fake a SFNT font directory entry for a font table -// see http://developer.apple.com/fonts/TTRefMan/RM06/Chap6.html#Directory -static void FakeDirEntry( const char aTag[5], ByteCount nOfs, ByteCount nLen, - const unsigned char* /*pData*/, unsigned char*& rpDest ) -{ -// write entry tag -rpDest[ 0] = aTag[0]; -rpDest[ 1] = aTag[1]; -rpDest[ 2] = aTag[2]; -rpDest[ 3] = aTag[3]; -// TODO: get entry checksum and write it -// not too important since the subsetter doesn't care currently -// for( pData+nOfs ... pData+nOfs+nLen ) -// write entry offset -rpDest[ 8] = static_cast(nOfs >> 24); -rpDest[ 9] = static_cast(nOfs >> 16); -rpDest[10] = static_cast(nOfs >> 8); -rpDest[11] = static_cast(nOfs >> 0); -// write entry length -rpDest[12] = static_cast(nLen >> 24); -rpDest[13] = static_cast(nLen >> 16); -rpDest[14] = static_cast(nLen >> 8); -rpDest[15] = static_cast(nLen >> 0); -// advance to next entry -rpDest += 16; -} - -// fake a TTF or CFF font as directly accessing font file is not possible -// when only the fontid is known. This approach also handles *.font fonts. -bool AquaSalGraphics::GetRawFontData( const vcl::font::PhysicalFontFace* pFontData, - std::vector& rBuffer, bool* pJustCFF ) -{ -const CoreTextFontFace* pMacFont = static_cast(pFontData); - -// short circuit for CFF-only fonts -const int nCffSize = pMacFont->GetFontTable( "CFF ", nullptr); -if( pJustCFF != nullptr ) -{ -*pJustCFF = (nCffSize > 0); -if( *pJustCFF) -{ -rBuffer.resize( nCffSize); -const int nCffRead = pMacFont->GetFontTable( "CFF ", rBuffer.data()); -if( nCffRead != nCffSize) -{ -return false; -} -return true; -} -} - -// get font table availability and size in bytes -const int nHeadSize = pMacFont->GetFontTable( "head", nullptr); -if( nHeadSize <= 0) -return false; - -const int nMaxpSize = pMacFont->GetFontTable( "maxp", nullptr); -if( nMaxpSize <= 0) -return
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/unx
vcl/inc/unx/fontmanager.hxx |7 ++- vcl/quartz/salgdicommon.cxx |2 +- vcl/unx/generic/fontmanager/fontmanager.cxx |5 +++-- vcl/unx/generic/gdi/freetypetextrender.cxx |9 + vcl/unx/generic/print/genpspgraphics.cxx|9 + 5 files changed, 8 insertions(+), 24 deletions(-) New commits: commit 05b3d7ea4673654e809be816bee0fa67fbf0308a Author: Khaled Hosny AuthorDate: Thu Sep 8 02:03:20 2022 +0200 Commit: خالد حسني CommitDate: Thu Sep 8 16:31:42 2022 +0200 vcl: Pass FontCharMap to OpenTTFont*() when possible Avoids parsing “cmap” table again to get it. Change-Id: I19eb882efd8c8aaaeb2fa770405ef2d69d985104 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139622 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index f9b1930175da..f85a80901f74 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -267,18 +267,15 @@ public: // creates a new font subset of an existing SFNT font // returns true in case of success, else false -// nFont: the font to be subsetted +// pFace: the font face to be subsetted // rOutFile: the file to put the new subset into; // must be a valid osl file URL // pGlyphIDs: input array of glyph ids for new font // pNewEncoding: the corresponding encoding in the new font -// pWidths: output array of widths of requested glyphs // nGlyphs: number of glyphs in arrays -// pCapHeight:: capital height of the produced font -// pXMin, pYMin, pXMax, pYMax: outgoing font bounding box // TODO: callers of this method should use its FontSubsetInfo counterpart directly bool createFontSubset( FontSubsetInfo&, - fontID nFont, + const vcl::font::PhysicalFontFace* pFace, const OUString& rOutFile, const sal_GlyphId* pGlyphIDs, const sal_uInt8* pNewEncoding, diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 992db536e7d5..d9ca95d997a0 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -79,7 +79,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile, // prepare data for psprint's font subsetter TrueTypeFont* pSftFont = nullptr; -if (::OpenTTFontBuffer( static_cast(aBuffer.data()), aBuffer.size(), 0, ) +if (::OpenTTFontBuffer( static_cast(aBuffer.data()), aBuffer.size(), 0, , pFontData->GetFontCharMap()) != SFErrCodes::Ok) return false; diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index e0131081481b..33ccb9987dad 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -941,13 +941,14 @@ int PrintFontManager::getFontDescend( fontID nFontID ) // TODO: move most of this stuff into the central font-subsetting code bool PrintFontManager::createFontSubset( FontSubsetInfo& rInfo, -fontID nFont, +const vcl::font::PhysicalFontFace* pFace, const OUString& rOutFile, const sal_GlyphId* pGlyphIds, const sal_uInt8* pNewEncoding, int nGlyphs ) { +psp::fontID nFont = pFace->GetFontId(); PrintFont* pFont = getFont( nFont ); if( !pFont ) return false; @@ -988,7 +989,7 @@ bool PrintFontManager::createFontSubset( const OString aFromFile = getFontFile( *pFont ); TrueTypeFont* pTTFont = nullptr; // TODO: rename to SfntFont -if( OpenTTFontFile( aFromFile.getStr(), pFont->m_nCollectionEntry, ) != SFErrCodes::Ok ) +if( OpenTTFontFile( aFromFile.getStr(), pFont->m_nCollectionEntry, , pFace->GetFontCharMap() ) != SFErrCodes::Ok ) return false; // prepare system name for write access for subset file target diff --git a/vcl/unx/generic/gdi/freetypetextrender.cxx b/vcl/unx/generic/gdi/freetypetextrender.cxx index 555bd2586eb9..beff9f33e652 100644 --- a/vcl/unx/generic/gdi/freetypetextrender.cxx +++ b/vcl/unx/generic/gdi/freetypetextrender.cxx @@ -136,16 +136,9 @@ bool FreeTypeTextRenderImpl::CreateFontSubset( FontSubsetInfo& rInfo ) { -// in this context the pFont->GetFontId() is a valid PSP -// font since they are the only ones left after the PDF -// export has filtered its list of subsettable fonts (for -// which this method was created). The correct way would -// be to have the FreetypeManager search for the PhysicalFontFace
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/unx
vcl/inc/quartz/salgdi.h|2 + vcl/quartz/ctfonts.cxx | 46 - vcl/unx/generic/glyphs/freetype_glyphcache.cxx |4 +- 3 files changed, 49 insertions(+), 3 deletions(-) New commits: commit 30a8f7e97d41d60098dbd14118d4f56c5557c06d Author: Khaled Hosny AuthorDate: Fri Sep 2 01:47:23 2022 +0200 Commit: خالد حسني CommitDate: Fri Sep 2 10:09:35 2022 +0200 vcl: set hb_font_t variations from CTFont Without this we will be using the interpolated outlines (done by core text) but apply OpenType features from the default instance. Change-Id: I7a39b5483ba0f35b440841ffa07f587ad966bbf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139248 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 569a14a6d3fc..29739adf33eb 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -107,6 +107,8 @@ private: hb_font_t* ImplInitHbFont() override; bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; +void SetFontVariationsOnHBFont(hb_font_t*) const; + /// CoreText text style object CFMutableDictionaryRef mpStyleDict; }; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 7985905cc404..e5db219c3f8d 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -251,11 +251,55 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU return pBlob; } +void CoreTextStyle::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const +{ + +CTFontRef aCTFontRef = static_cast(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); + +CFArrayRef pAxes = CTFontCopyVariationAxes(aCTFontRef); +if (!pAxes) +return; + +CFDictionaryRef pVariations = CTFontCopyVariation(aCTFontRef); +std::vector aHBVariations; +if (pVariations) +{ +CFIndex nAxes = CFArrayGetCount(pAxes); +for (CFIndex i = 0; i < nAxes; ++i) +{ +auto pAxis = static_cast(CFArrayGetValueAtIndex(pAxes, i)); +if (pAxis) +{ +hb_tag_t nTag; +auto pTag = static_cast(CFDictionaryGetValue(pAxis, kCTFontVariationAxisIdentifierKey)); +if (!pTag) +continue; +CFNumberGetValue(pTag, kCFNumberIntType, ); + +float fValue; +auto pValue = static_cast(CFDictionaryGetValue(pVariations, pTag)); +if (!pValue) +continue; +CFNumberGetValue(pValue, kCFNumberFloatType, ); + +aHBVariations.push_back({ nTag, fValue }); +} +} +CFRelease(pVariations); +} +CFRelease(pAxes); + +if (!aHBVariations.empty()) +hb_font_set_variations(pHbFont, aHBVariations.data(), aHBVariations.size()); +} + hb_font_t* CoreTextStyle::ImplInitHbFont() { hb_face_t* pHbFace = hb_face_create_for_tables(getFontTable, GetFontFace(), nullptr); +hb_font_t* pHBFont = InitHbFont(pHbFace); +SetFontVariationsOnHBFont(pHBFont); -return InitHbFont(pHbFace); +return pHBFont; } rtl::Reference CoreTextFontFace::CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index a995a0fe1f2b..693d7a646436 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -212,7 +212,7 @@ FT_FaceRec_* FreetypeFontInfo::GetFaceFT() return maFaceFT; } -void FreetypeFont::SetFontVariationsOnHBFont(hb_font_t* pHbFace) const +void FreetypeFont::SetFontVariationsOnHBFont(hb_font_t* pHbFont) const { sal_uInt32 nFaceVariation = mxFontInfo->GetFontFaceVariation(); if (!(maFaceFT && nFaceVariation)) @@ -231,7 +231,7 @@ void FreetypeFont::SetFontVariationsOnHBFont(hb_font_t* pHbFace) const aVariations[i].tag = pFtMMVar->axis[i].tag; aVariations[i].value = instance->coords[i] / 65536.0; } -hb_font_set_variations(pHbFace, aVariations.data(), aVariations.size()); +hb_font_set_variations(pHbFont, aVariations.data(), aVariations.size()); } dlFT_Done_MM_Var(aLibFT, pFtMMVar); }
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/skia
vcl/inc/quartz/salgdi.h |4 ++-- vcl/inc/skia/osx/gdiimpl.hxx |3 ++- vcl/quartz/salgdi.cxx| 12 ++-- vcl/skia/osx/gdiimpl.cxx | 11 --- 4 files changed, 22 insertions(+), 8 deletions(-) New commits: commit d59f1570cb9a49f3daf159b80744e5c93a74dc5a Author: Caolán McNamara AuthorDate: Fri Jan 14 10:54:48 2022 + Commit: Caolán McNamara CommitDate: Fri Jan 14 14:50:38 2022 +0100 respect TextRenderModeForResolutionIndependentLayout for mac too Change-Id: I1e572bd03387e1708fe75b90c2bce220b41c29e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128409 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index f0aa925c6083..569a14a6d3fc 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -297,7 +297,7 @@ public: const tools::Rectangle , ControlState nState, const ImplControlValue ) = 0; -virtual void drawTextLayout(const GenericSalLayout& layout) = 0; +virtual void drawTextLayout(const GenericSalLayout& layout, bool bTextRenderModeForResolutionIndependentLayout) = 0; virtual void Flush() {} virtual void Flush( const tools::Rectangle& ) {} protected: @@ -446,7 +446,7 @@ public: ControlState nState, const ImplControlValue ) override; -virtual void drawTextLayout(const GenericSalLayout& layout) override; +virtual void drawTextLayout(const GenericSalLayout& layout, bool bTextRenderModeForResolutionIndependentLayout) override; bool supportsOperation(OutDevSupportType eType) const override; }; diff --git a/vcl/inc/skia/osx/gdiimpl.hxx b/vcl/inc/skia/osx/gdiimpl.hxx index e59aa60f56df..71baf24625fc 100644 --- a/vcl/inc/skia/osx/gdiimpl.hxx +++ b/vcl/inc/skia/osx/gdiimpl.hxx @@ -38,7 +38,8 @@ public: const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue) override; -virtual void drawTextLayout(const GenericSalLayout& layout) override; +virtual void drawTextLayout(const GenericSalLayout& layout, +bool bTextRenderModeForResolutionIndependentLayout) override; virtual void Flush() override; virtual void Flush(const tools::Rectangle&) override; diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 5a1051965b6c..cbeaea4fc62b 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -362,10 +362,10 @@ bool AquaSalGraphics::AddTempDevFont(vcl::font::PhysicalFontCollection*, void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) { -mpBackend->drawTextLayout(rLayout); +mpBackend->drawTextLayout(rLayout, getTextRenderModeForResolutionIndependentLayoutEnabled()); } -void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout) +void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout, bool bTextRenderModeForResolutionIndependentLayout) { #ifdef IOS if (!mrShared.checkContext()) @@ -459,6 +459,14 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout) CGContextSetTextDrawingMode(mrShared.maContextHolder.get(), kCGTextFillStroke); } +if (bTextRenderModeForResolutionIndependentLayout) +{ + CGContextSetAllowsFontSubpixelQuantization(mrShared.maContextHolder.get(), false); + CGContextSetShouldSubpixelQuantizeFonts(mrShared.maContextHolder.get(), false); + CGContextSetAllowsFontSubpixelPositioning(mrShared.maContextHolder.get(), true); + CGContextSetShouldSubpixelPositionFonts(mrShared.maContextHolder.get(), true); +} + auto aIt = aGlyphOrientation.cbegin(); while (aIt != aGlyphOrientation.cend()) { diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index fa3f1c528322..1035d998a1c8 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -261,7 +261,8 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n return bOK; } -void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout) +void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout, + bool bSubpixelPositioning) { const CoreTextStyle& rStyle = *static_cast(()); const vcl::font::FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); @@ -295,8 +296,12 @@ void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout) //font.setScaleX(rStyle.mfFontStretch); TODO if (rStyle.mbFauxBold) font.setEmbolden(true); -font.setEdging(!mrShared.mbNonAntialiasedText ? SkFont::Edging::kAntiAlias - :
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |2 +- vcl/quartz/salgdi.cxx |6 ++ vcl/quartz/salgdicommon.cxx | 12 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) New commits: commit 1e70359ac7f2e10f7cefe006557b3df8e5a46ae0 Author: Tomaž Vajngerl AuthorDate: Thu Apr 8 13:27:34 2021 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Apr 27 15:59:11 2021 +0200 vcl: store XorEmulation in a unique_ptr not raw pointer Change-Id: I123c4048d333cdc761582763d6ccb9c254e32bbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114700 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 421cbffba55b..80e6c66d1a00 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -137,7 +137,7 @@ class AquaSalGraphics : public SalGraphics CGContextHolder maBGContextHolder; // Quartz drawing context for CGLayer CGContextHolder maCSContextHolder; // Quartz drawing context considering the color space -XorEmulation* mpXorEmulation; +std::unique_ptr mpXorEmulation; int mnXorMode; // 0: off 1: on 2: invert only int mnWidth; int mnHeight; diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index ae6a40cfd4e2..375fea64a5cb 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -186,8 +186,7 @@ bool CoreTextFontFace::GetFontCapabilities(vcl::FontCapabilities } AquaSalGraphics::AquaSalGraphics() -: mpXorEmulation( nullptr ) -, mnXorMode( 0 ) +: mnXorMode( 0 ) , mnWidth( 0 ) , mnHeight( 0 ) , mnBitmapDepth( 0 ) @@ -229,8 +228,7 @@ AquaSalGraphics::~AquaSalGraphics() ReleaseFonts(); -if( mpXorEmulation ) -delete mpXorEmulation; +mpXorEmulation.reset(); #ifdef IOS if (mbForeignContext) diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 51e35e79905a..db6715ce01e2 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -242,11 +242,11 @@ static Color ImplGetROPColor( SalROPColor nROPColor ) // apply the XOR mask to the target context if active and dirty void AquaSalGraphics::ApplyXorContext() { -if( !mpXorEmulation ) +if (!mpXorEmulation) { return; } -if( mpXorEmulation->UpdateTarget() ) +if (mpXorEmulation->UpdateTarget()) { RefreshRect( 0, 0, mnWidth, mnHeight ); // TODO: refresh minimal changerect } @@ -1486,11 +1486,11 @@ void AquaSalGraphics::SetXORMode( bool bSet, bool bInvertOnly ) return; } -if( (mpXorEmulation == nullptr) && !bSet ) +if (!mpXorEmulation && !bSet) { return; } -if( (mpXorEmulation != nullptr) && (bSet == mpXorEmulation->IsEnabled()) ) +if (mpXorEmulation && bSet == mpXorEmulation->IsEnabled()) { return; } @@ -1499,9 +1499,9 @@ void AquaSalGraphics::SetXORMode( bool bSet, bool bInvertOnly ) return; } // prepare XOR emulation -if( !mpXorEmulation ) +if (!mpXorEmulation) { -mpXorEmulation = new XorEmulation(); +mpXorEmulation = std::make_unique(); mpXorEmulation->SetTarget(mnWidth, mnHeight, mnBitmapDepth, maContextHolder.get(), maLayer.get()); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h|2 +- vcl/quartz/salgdi.cxx |8 vcl/quartz/salgdiutils.cxx |9 - 3 files changed, 1 insertion(+), 18 deletions(-) New commits: commit 6bf3de9144780330a99e7512ade8c31c44b8365b Author: Tor Lillqvist AuthorDate: Wed Dec 30 16:48:08 2020 +0200 Commit: Tor Lillqvist CommitDate: Thu Dec 31 13:09:18 2020 +0100 Bin unused AquaSalGraphics::GetContext() Change-Id: I53cfc0451dd67b7508d85050fbf262aafc361550 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108513 Tested-by: Tor Lillqvist Reviewed-by: Tor Lillqvist diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index db47dac517a1..6d7db6a6dd60 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -206,7 +206,7 @@ public: voidImplDrawPixel( tools::Long nX, tools::Long nY, const RGBAColor& ); // helper to draw single pixels boolCheckContext(); -CGContextRefGetContext(); + #ifdef MACOSX voidUpdateWindow( NSRect& ); // delivered in NSView coordinates voidRefreshRect( const NSRect& ); diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 704bba1fae9c..ae6a40cfd4e2 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -833,14 +833,6 @@ bool AquaSalGraphics::CheckContext() return false; } -CGContextRef AquaSalGraphics::GetContext() -{ -if (!maContextHolder.isSet()) -CheckContext(); - -return maContextHolder.get(); -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx index 985fe38a2d11..94ecb9c5af53 100644 --- a/vcl/quartz/salgdiutils.cxx +++ b/vcl/quartz/salgdiutils.cxx @@ -207,15 +207,6 @@ bool AquaSalGraphics::CheckContext() return maContextHolder.isSet(); } -CGContextRef AquaSalGraphics::GetContext() -{ -if (!maContextHolder.isSet()) -{ -CheckContext(); -} -return maContextHolder.get(); -} - /** * Blit the contents of our internal maLayer state to the * associated window, if any; cf. drawRect event handling ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/utils.h |2 ++ vcl/quartz/utils.cxx | 26 ++ 2 files changed, 28 insertions(+) New commits: commit b126def60fc5280d40bc25db86748ed798c8548d Author: Tor Lillqvist AuthorDate: Mon Dec 21 15:15:54 2020 +0200 Commit: Tor Lillqvist CommitDate: Mon Dec 21 23:46:34 2020 +0100 Add two debug output helper functions Change-Id: I38a234e6f4a3fc5e0f17cfd9a0068d2081b6c654 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108099 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tor Lillqvist Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108100 Tested-by: Tor Lillqvist diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h index a2a39f2605d2..759e47f72f2b 100644 --- a/vcl/inc/quartz/utils.h +++ b/vcl/inc/quartz/utils.h @@ -38,6 +38,8 @@ OUString GetOUString( CFStringRef ); OUString GetOUString( const NSString* ); CFStringRef CreateCFString( const OUString& ); NSString* CreateNSString( const OUString& ); +OUString NSStringArrayToOUString(NSArray* array); +OUString NSDictionaryKeysToOUString(NSDictionary* dict); std::ostream <<(std::ostream& s, const CGRect ); std::ostream <<(std::ostream& s, const CGPoint ); diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx index cc18eb0d409f..0182ec118886 100644 --- a/vcl/quartz/utils.cxx +++ b/vcl/quartz/utils.cxx @@ -85,6 +85,32 @@ NSString* CreateNSString( const OUString& rStr ) return [[NSString alloc] initWithCharacters: reinterpret_cast(rStr.getStr()) length: rStr.getLength()]; } +OUString NSStringArrayToOUString(NSArray* array) +{ +OUString result = "["; +OUString sep; +for (unsigned i = 0; i < [array count]; i++) +{ +result = result + sep + OUString::fromUtf8([[array objectAtIndex:i] UTF8String]); +sep = ","; +} +result = result + "]"; +return result; +} + +OUString NSDictionaryKeysToOUString(NSDictionary* dict) +{ +OUString result = "{"; +OUString sep; +for (NSString *key in dict) +{ +result = result + sep + OUString::fromUtf8([key UTF8String]); +sep = ","; +} +result = result + "}"; +return result; +} + std::ostream <<(std::ostream& s, const CGRect ) { #ifndef SAL_LOG_INFO ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salvd.h |2 +- vcl/quartz/salvd.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 65dc2fdc67537fe061052d53811c10bf03d5a113 Author: Tor Lillqvist AuthorDate: Thu Dec 3 00:23:46 2020 +0200 Commit: Tor Lillqvist CommitDate: Thu Dec 3 00:26:49 2020 +0200 There is nothing called "Quartz layer" We mean CGLayer, so say so. Change-Id: Iaa24471ce790114dc5cf2bbf353f9aa4a1d59893 diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h index 41d43fa5e538..939bd041cee1 100644 --- a/vcl/inc/quartz/salvd.h +++ b/vcl/inc/quartz/salvd.h @@ -43,7 +43,7 @@ private: bool mbForeignContext; // is mxContext from outside VCL CGContextHolder maBitmapContext; int mnBitmapDepth; -CGLayerHolder maLayer; // Quartz layer +CGLayerHolder maLayer; AquaSalGraphics* mpGraphics; // current VirDev graphics tools::Long mnWidth; diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index 57ba971a927a..6462a51573ce 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -228,7 +228,7 @@ bool AquaSalVirtualDevice::SetSize( tools::Long nDX, tools::Long nDY ) mnWidth = nDX; mnHeight = nDY; -// create a Quartz layer matching to the intended virdev usage +// create a CGLayer matching to the intended virdev usage CGContextHolder xCGContextHolder; if( mnBitmapDepth && (mnBitmapDepth < 16) ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |2 + vcl/quartz/salgdicommon.cxx |3 ++ vcl/quartz/salgdiutils.cxx | 46 ++-- 3 files changed, 45 insertions(+), 6 deletions(-) New commits: commit 87964eb39e2668f80bcbf503d9a3b55a7f86ce28 Author: 191919 AuthorDate: Tue Oct 27 15:38:39 2020 +0800 Commit: Noel Grandin CommitDate: Thu Oct 29 16:38:01 2020 +0100 Speed improments Improve drawing performance on 10-bit displays by avoiding multiple color space conversions. Make all drawing context bitmaps have the colour space and byte order of the host window. Fix serious CoreGraphics-related memory leak (existed no later than version 7.0) when changing the window size. Change-Id: Ia7b7e88d47b728bd1d10dedc1ca15de41e73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104858 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 8058b68378b6..0aaf71f0f839 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -134,6 +134,8 @@ class AquaSalGraphics : public SalGraphics { CGLayerHolder maLayer; // Quartz graphics layer CGContextHolder maContextHolder; // Quartz drawing context +CGContextHolder maBGContextHolder; // Quartz drawing context for CGLayer +CGContextHolder maCSContextHolder; // Quartz drawing context considering the color space XorEmulation* mpXorEmulation; int mnXorMode; // 0: off 1: on 2: invert only diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 7f96124f96ac..7c7dcac7898f 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -426,11 +426,14 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, CGContextScaleCTM( xSrcContext, +1, -1 ); aSrcPoint.y = (nScaledSourceY + nScaledSourceHeight) - (mnHeight * fScale); } +CGContextSetBlendMode(xSrcContext, kCGBlendModeCopy); + CGContextDrawLayerAtPoint(xSrcContext, aSrcPoint, maLayer.get()); } // draw at new destination const CGRect aTargetRect = CGRectMake(nScaledTargetX, nScaledTargetY, nScaledSourceWidth, nScaledSourceHeight); +CGContextSetBlendMode(xCopyContext, kCGBlendModeCopy); CGContextDrawLayerInRect(xCopyContext, aTargetRect, sSourceLayerHolder.get()); maContextHolder.restoreState(); diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx index 426aea29dc78..57953e536796 100644 --- a/vcl/quartz/salgdiutils.cxx +++ b/vcl/quartz/salgdiutils.cxx @@ -69,11 +69,28 @@ void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, lon void AquaSalGraphics::InvalidateContext() { UnsetState(); + +CGContextRelease(maContextHolder.get()); +CGContextRelease(maBGContextHolder.get()); +CGContextRelease(maCSContextHolder.get()); + maContextHolder.set(nullptr); +maCSContextHolder.set(nullptr); +maBGContextHolder.set(nullptr); } void AquaSalGraphics::UnsetState() { +if (maBGContextHolder.isSet()) +{ +CGContextRelease(maBGContextHolder.get()); +maBGContextHolder.set(nullptr); +} +if (maCSContextHolder.isSet()) +{ +CGContextRelease(maCSContextHolder.get()); +maBGContextHolder.set(nullptr); +} if (maContextHolder.isSet()) { maContextHolder.restoreState(); @@ -119,7 +136,12 @@ bool AquaSalGraphics::CheckContext() { CGContextRelease(maContextHolder.get()); } +CGContextRelease(maBGContextHolder.get()); +CGContextRelease(maCSContextHolder.get()); + maContextHolder.set(nullptr); +maBGContextHolder.set(nullptr); +maCSContextHolder.set(nullptr); maLayer.set(nullptr); } @@ -133,14 +155,17 @@ bool AquaSalGraphics::CheckContext() const CGSize aLayerSize = { static_cast(nScaledWidth), static_cast(nScaledHeight) }; const int nBytesPerRow = (nBitmapDepth * nScaledWidth) / 8; -void* pRawData = std::malloc(nBytesPerRow * nScaledHeight); -const int nFlags = kCGImageAlphaNoneSkipFirst; -CGContextHolder aContextHolder(CGBitmapContextCreate( -pRawData, nScaledWidth, nScaledHeight, 8, nBytesPerRow, GetSalData()->mxRGBSpace, nFlags)); +int nFlags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; +maBGContextHolder.set(CGBitmapContextCreate( +NULL, nScaledWidth, nScaledHeight, 8, nBytesPerRow, GetSalData()->mxRGBSpace, nFlags)); -maLayer.set(CGLayerCreateWithContext(aContextHolder.get(), aLayerSize, nullptr)); +maLayer.set(CGLayerCreateWithContext(maBGContextHolder.get(), aLayerSize, nullptr));
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/utils.h |1 vcl/quartz/utils.cxx | 56 + 2 files changed, 57 insertions(+) New commits: commit 2cd47f53b4c7bd300c210eaa466e13adc832c9b5 Author: Tor Lillqvist AuthorDate: Sun Oct 18 14:20:24 2020 +0300 Commit: Tor Lillqvist CommitDate: Sun Oct 18 14:44:24 2020 +0200 tdf#137468: Add debug output function for CGColorSpaceRef Change-Id: I6fdb00652bf3dd892b531b80c2bb621ff22e8717 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104475 Tested-by: Jenkins Reviewed-by: Tor Lillqvist diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h index 2452c151d28e..a2a39f2605d2 100644 --- a/vcl/inc/quartz/utils.h +++ b/vcl/inc/quartz/utils.h @@ -44,6 +44,7 @@ std::ostream <<(std::ostream& s, const CGPoint ); std::ostream <<(std::ostream& s, const CGSize ); std::ostream <<(std::ostream& s, CGColorRef pSize); std::ostream <<(std::ostream& s, const CGAffineTransform ); +std::ostream <<(std::ostream& s, CGColorSpaceRef cs); #endif // INCLUDED_VCL_INC_QUARTZ_UTILS_H diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx index 0e0ac8f4d90a..1bbd5cdde873 100644 --- a/vcl/quartz/utils.cxx +++ b/vcl/quartz/utils.cxx @@ -158,4 +158,60 @@ std::ostream <<(std::ostream& s, const CGAffineTransform ) return s; } +std::ostream <<(std::ostream& s, CGColorSpaceRef cs) +{ +#ifndef SAL_LOG_INFO +(void) cs; +#else +if (cs == nullptr) +{ +s << "null"; +return s; +} + +CGColorSpaceModel model = CGColorSpaceGetModel(cs); +switch (model) +{ +case kCGColorSpaceModelUnknown: +s << "Unknown"; +break; +case kCGColorSpaceModelMonochrome: +s << "Monochrome"; +break; +case kCGColorSpaceModelRGB: +s << "RGB"; +if (CGColorSpaceIsWideGamutRGB(cs)) +s << " (wide gamut)"; +break; +case kCGColorSpaceModelCMYK: +s << "CMYK"; +break; +case kCGColorSpaceModelLab: +s << "Lab"; +break; +case kCGColorSpaceModelDeviceN: +s << "DeviceN"; +break; +case kCGColorSpaceModelIndexed: +s << "Indexed (" << CGColorSpaceGetColorTableCount(cs) << ")"; +break; +case kCGColorSpaceModelPattern: +s << "Pattern"; +break; +case kCGColorSpaceModelXYZ: +s << "XYZ"; +break; +default: +s << "?(" << model << ")"; +break; +} + +CFStringRef name = CGColorSpaceCopyName(cs); +if (name != NULL) +s << " (" << [(NSString *)name UTF8String] << ")"; + +return s; +#endif +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/win
vcl/inc/salgdi.hxx | 13 + vcl/quartz/salgdi.cxx | 46 vcl/source/gdi/salgdilayout.cxx | 56 vcl/win/gdi/salfont.cxx | 39 --- 4 files changed, 71 insertions(+), 83 deletions(-) New commits: commit a88c9752c6251dceb77c809b4592f2516e10f3e6 Author: Jan-Marek Glogowski AuthorDate: Fri Sep 11 17:24:59 2020 +0200 Commit: Jan-Marek Glogowski CommitDate: Tue Sep 15 06:42:13 2020 +0200 WIN OSX unify GetGlyphWidths code Now that GetFontChatMap is a member of PhysicalFontFace, we can copy the common part of both architectures into a SalGraphics helper function. Change-Id: Iad379ea690a1c5346b69b5042188506ccf575cc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102684 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index d2b92c65110f..2e83e558a3c7 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -54,6 +54,11 @@ namespace basegfx { class B2DPolyPolygon; } +namespace vcl +{ +class AbstractTrueTypeFont; +} + typedef sal_Unicode sal_Ucs; // TODO: use sal_UCS4 instead of sal_Unicode typedef std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap; @@ -613,6 +618,14 @@ protected: std::unique_ptr m_pWidgetDraw; vcl::WidgetDrawInterface* forWidget() { return m_pWidgetDraw ? m_pWidgetDraw.get() : this; } + +#if defined(_WIN32) || defined(MACOSX) || defined(IOS) +static void GetGlyphWidths(const vcl::TrueTypeFont& rTTF, +#else +static void GetGlyphWidths(const vcl::AbstractTrueTypeFont& rTTF, +#endif + const PhysicalFontFace& rFontFace, bool bVertical, + std::vector& rWidths, Ucs2UIntMap& rUnicodeEnc); }; bool SalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart) diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 4cab7731eca5..2c1fdff16eec 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -763,51 +763,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV if( nRC != SFErrCodes::Ok ) return; -const int nGlyphCount = pSftFont->glyphCount(); -if( nGlyphCount > 0 ) -{ -// get glyph metrics -rGlyphWidths.resize(nGlyphCount); -std::vector aGlyphIds(nGlyphCount); -for( int i = 0; i < nGlyphCount; i++ ) -{ -aGlyphIds[i] = static_cast(i); -} - -std::unique_ptr pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aGlyphIds.data(), - nGlyphCount, bVertical ); -if( pGlyphMetrics ) -{ -for( int i = 0; i < nGlyphCount; ++i ) -{ -rGlyphWidths[i] = pGlyphMetrics[i]; -} -pGlyphMetrics.reset(); -} - -rtl::Reference rCTFontData(new CoreTextFontFace(*pFontData, pFontData->GetFontId())); -FontCharMapRef xFCMap = rCTFontData->GetFontCharMap(); -SAL_WARN_IF( !xFCMap.is() || !xFCMap->GetCharCount(), "vcl", "no charmap" ); - -// get unicode<->glyph encoding -// TODO? avoid sft mapping by using the xFCMap itself -int nCharCount = xFCMap->GetCharCount(); -sal_uInt32 nChar = xFCMap->GetFirstChar(); -for( ; --nCharCount >= 0; nChar = xFCMap->GetNextChar( nChar ) ) -{ -if( nChar > 0x ) // TODO: allow UTF-32 chars -break; - -sal_Ucs nUcsChar = static_cast(nChar); -sal_uInt32 nGlyph = ::MapChar( pSftFont, nUcsChar ); -if( nGlyph > 0 ) -{ -rUnicodeEnc[ nUcsChar ] = nGlyph; -} -} - -xFCMap = nullptr; -} +SalGraphics::GetGlyphWidths(*pSftFont, *pFontData, bVertical, rGlyphWidths, rUnicodeEnc); ::CloseTTFont( pSftFont ); } diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 21844bff732a..63c3c8b8dc7d 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -28,8 +28,10 @@ #include #endif #endif +#include #include #include +#include #include #include #include @@ -894,4 +896,58 @@ OUString SalGraphics::getRenderBackendName() const return OUString(); } +#if defined(_WIN32) || defined(MACOSX) || defined(IOS) +void SalGraphics::GetGlyphWidths(const vcl::TrueTypeFont& rTTF, +#else +void SalGraphics::GetGlyphWidths(const vcl::AbstractTrueTypeFont& rTTF, +#endif + const PhysicalFontFace& rFontFace, const bool bVertical, + std::vector& rWidths, Ucs2UIntMap& rUnicodeEnc) +{ +rWidths.clear(); +rUnicodeEnc.clear(); + +const int nGlyphCount = rTTF.glyphCount(); +if (nGlyphCount <= 0) +return;
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/fontsubset.hxx |2 vcl/inc/sft.hxx | 71 ++- vcl/quartz/salgdi.cxx |2 vcl/source/fontsubset/fontsubset.cxx|6 vcl/source/fontsubset/sft.cxx | 603 +--- vcl/unx/generic/fontmanager/fontmanager.cxx | 14 vcl/win/gdi/salfont.cxx |3 7 files changed, 353 insertions(+), 348 deletions(-) New commits: commit 4c05d61a4393d38834254f03a83aa01b7582060b Author: Jan-Marek Glogowski AuthorDate: Fri Aug 14 04:05:56 2020 +0200 Commit: Jan-Marek Glogowski CommitDate: Sat Aug 15 13:18:05 2020 +0200 Refactor vcl::TrueTypeFont class member access This hides all members, which are needed to create a new TTF font by calling vcl::CreateTTFromTTGlyphs, and adds an abstraction to access individual font tables. This is needed, because Qt5 just allows access to the raw font based on font tables. Change-Id: I74e34cf1aa2529a06ec5ec53aa2be751e58982ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100717 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx index 54fa2094684f..1a4c7b80b118 100644 --- a/vcl/inc/fontsubset.hxx +++ b/vcl/inc/fontsubset.hxx @@ -27,7 +27,7 @@ #include #include -namespace vcl { struct TrueTypeFont; } ///< SFT's idea of a TTF font +namespace vcl { class TrueTypeFont; } ///< SFT's idea of a TTF font enum class FontType { NO_FONT = 0, diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index aca60a45641e..6bcf40f03824 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -183,7 +183,6 @@ namespace vcl sal_Int16 y; /**< Y coordinate in EmSquare units */ } ControlPoint; -struct TrueTypeFont; /* Some table OS/2 consts @@ -448,6 +447,7 @@ constexpr sal_uInt32 T_fpgm = 0x6670676D; constexpr sal_uInt32 T_gsub = 0x47535542; constexpr sal_uInt32 T_CFF = 0x43464620; +class TrueTypeFont; /** * @defgroup sft Sun Font Tools Exported Functions @@ -687,17 +687,6 @@ constexpr sal_uInt32 T_CFF = 0x43464620; const uint8_t *pOs2, size_t nOs2, TTGlobalFontInfo *info); -/** - * returns the number of glyphs in a font - */ - VCL_DLLPUBLIC int GetTTGlyphCount( TrueTypeFont const * ttf ); - -/** - * provide access to the raw data of a SFNT-container's subtable - */ - bool GetSfntTable( TrueTypeFont const * ttf, int nSubtableIndex, - const sal_uInt8** ppRawBytes, int* pRawLength ); - /*- private definitions */ /* indexes into TrueTypeFont::tables[] and TrueTypeFont::tlens[] */ @@ -720,8 +709,26 @@ constexpr int O_gsub = 15; /* 'GSUB' */ constexpr int O_CFF = 16; /* 'CFF' */ constexpr int NUM_TAGS = 17; -struct TrueTypeFont { -char*fname; +class TrueTypeFont final +{ +char* m_pFileName; +sal_uInt32 m_nGlyphs; +sal_uInt32* m_pGlyphOffsets; +sal_uInt32 m_nHorzMetrics; +sal_uInt32 m_nVertMetrics; /* if not 0 => font has vertical metrics information */ +sal_uInt32 m_nUnitsPerEm; + +struct TTFontTable_ +{ +const sal_uInt8* pData = nullptr; /* pointer to a raw subtable in the SFNT file */ +sal_uInt32 nSize = 0; /* table size */ +}; + +std::array m_aTableList; + +SFErrCodes indexGlyphData(); + +public: sal_Int32 fsize; sal_uInt8 *ptr; @@ -732,18 +739,38 @@ constexpr int NUM_TAGS = 17; sal_Unicode *usubfamily; sal_uInt32 ntables; -sal_uInt32 *goffsets; -sal_uInt32 nglyphs; -sal_uInt32 unitsPerEm; -sal_uInt32 numberOfHMetrics; -sal_uInt32 numOfLongVerMetrics; /* if this number is not 0, font has vertical metrics information */ const sal_uInt8* cmap; int cmapType; sal_uInt32 (*mapper)(const sal_uInt8 *, sal_uInt32, sal_uInt32); /* character to glyphID translation function */ -std::array tables; /* array of pointers to raw subtables in SFNT file*/ -std::array tlens; /* array of table lengths */ -}; +TrueTypeFont(const char* pFileName = nullptr); +~TrueTypeFont(); + +SFErrCodes open(sal_uInt32 facenum); + +const char* fileName() const { return m_pFileName; } +sal_uInt32 glyphCount() const { return m_nGlyphs; } +sal_uInt32 glyphOffset(sal_uInt32 glyphID) const { return m_pGlyphOffsets[glyphID]; } +sal_uInt32 horzMetricCount() const { return m_nHorzMetrics; } +sal_uInt32 vertMetricCount() const { return m_nVertMetrics; } +sal_uInt32 unitsPerEm() const { return m_nUnitsPerEm; } + +bool hasTable(sal_uInt32 ord) const { return m_aTableList[ord].pData != nullptr; } +inline const sal_uInt8*
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salbmp.h |2 ++ vcl/quartz/salbmp.cxx |7 ++- 2 files changed, 8 insertions(+), 1 deletion(-) New commits: commit 080931eb5c49b8a05d1bf6f9ddc1203b3e75aaa2 Author: Stephan Bergmann AuthorDate: Mon Sep 23 12:35:46 2019 +0200 Commit: Stephan Bergmann CommitDate: Mon Sep 23 14:57:18 2019 +0200 loplugin:fragiledestructor (macOS) Change-Id: I8ac1f67999ccbb6c411359ac6fd4c473dc339d44 Reviewed-on: https://gerrit.libreoffice.org/79398 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h index a5e6f510bc5d..87929249f787 100644 --- a/vcl/inc/quartz/salbmp.h +++ b/vcl/inc/quartz/salbmp.h @@ -96,6 +96,8 @@ public: CGImageRef CreateWithMask( const QuartzSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const; CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, Color nMaskColor ) const; CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const; + +void doDestroy(); }; #endif // INCLUDED_VCL_INC_QUARTZ_SALBMP_H diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index ee6598f7e0b6..710a9eb408ee 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -70,7 +70,7 @@ QuartzSalBitmap::QuartzSalBitmap() QuartzSalBitmap::~QuartzSalBitmap() { -Destroy(); +doDestroy(); } bool QuartzSalBitmap::Create(CGLayerHolder const & rLayerHolder, int nBitmapBits, int nX, int nY, int nWidth, int nHeight, bool bFlipped) @@ -176,6 +176,11 @@ bool QuartzSalBitmap::Create( const css::uno::Reference< css::rendering::XBitmap void QuartzSalBitmap::Destroy() { +doDestroy(); +} + +void QuartzSalBitmap::doDestroy() +{ DestroyContext(); m_pUserBuffer.reset(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |2 +- vcl/quartz/salgdi.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 89df4a82bbed0c2e3a4a8be0b995c4400377628c Author: Stephan Bergmann AuthorDate: Wed Aug 28 21:09:35 2019 +0200 Commit: Stephan Bergmann CommitDate: Wed Aug 28 22:39:46 2019 +0200 loplugin:returnconstval (macOS) Remove the spurious "const" that dates back to a poor change in 9177329a425cf70b515d1f266132838894fe54c6 "vcl: FontCharMap to use intrusive_ptr ImplFontCharMap": > --- a/vcl/inc/quartz/salgdi.h > +++ b/vcl/inc/quartz/salgdi.h > @@ -73,7 +73,7 @@ public: > CoreTextStyle* CreateTextStyle( const FontSelectPattern& ) const; > int GetFontTable( const char pTagName[5], unsigned char* ) const; > > -const ImplFontCharMap* GetImplFontCharMap() const; > +const ImplFontCharMapPtrGetImplFontCharMap() const; > bool GetFontCapabilities(vcl::FontCapabilities ) > const; > boolHasChar( sal_uInt32 cChar ) const; > Change-Id: I6a533a917ec42513b0783332c35e0a6803504324 Reviewed-on: https://gerrit.libreoffice.org/78235 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 8861cd79b9ad..338878e79529 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -67,7 +67,7 @@ public: int GetFontTable( uint32_t nTagCode, unsigned char* ) const; int GetFontTable( const char pTagName[5], unsigned char* ) const; -const FontCharMapRefGetFontCharMap() const; +FontCharMapRef GetFontCharMap() const; boolGetFontCapabilities(vcl::FontCapabilities ) const; boolHasChar( sal_uInt32 cChar ) const; diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index cf906d32acf3..0d5ecab6a419 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -113,7 +113,7 @@ sal_IntPtr CoreTextFontFace::GetFontId() const return mnFontId; } -const FontCharMapRef CoreTextFontFace::GetFontCharMap() const +FontCharMapRef CoreTextFontFace::GetFontCharMap() const { // return the cached charmap if( mxCharMap.is() ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/CGHelpers.hxx | 36 + vcl/quartz/salgdicommon.cxx | 37 ++ vcl/quartz/salgdiutils.cxx | 112 +++ 3 files changed, 124 insertions(+), 61 deletions(-) New commits: commit 959e8ae7ea33ce94dd80ee8ea172b6db64593873 Author: Tomaž Vajngerl AuthorDate: Tue May 21 14:46:56 2019 +0900 Commit: Tomaž Vajngerl CommitDate: Wed May 22 01:33:59 2019 +0200 tdf#124271 use the bitmap context, handle scaling The problem with latest macOS versions is that creating a graphic context with window (NSGraphicsContext graphicsContextWithWindow:) only works when actually drawing and otherwise it returns null. This caused problems before in AquaVrtualDevice, but we also use this when creating a device backing storage. This interestingly caused slowdowns and eventual crash, but the backtrace looked very misterious as it didn't crash because of a nullptr, but it halted all drawing commands and it crashed because of that. This changes the graphic context with a bitmap context, as it was already done in VirtualDevice and use that instead. The problem with a bitmap context is that we need to handle HiDPI scaling by ourselves now. LayerHolder was extended to store the scaling information of the layer (and its underlaying bitmap context) and provides methods that get the size of the layer in pixels or in scaling independent points (which is just size in pixels multiplied by the scaling factor). An known issue is that VirtualDevice also needs to take scaling into account, which it currently doesn't, so the text is still blurry on a HiDPI screen, but that was already true previously and is something that will be done in a different change. Change-Id: I8e10c518ecba285125746bd20525c4cb5ca67279 Reviewed-on: https://gerrit.libreoffice.org/72663 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/vcl/inc/quartz/CGHelpers.hxx b/vcl/inc/quartz/CGHelpers.hxx index f2d024dc9299..5d44e835d99b 100644 --- a/vcl/inc/quartz/CGHelpers.hxx +++ b/vcl/inc/quartz/CGHelpers.hxx @@ -22,22 +22,56 @@ class CGLayerHolder private: CGLayerRef mpLayer; +// Layer's scaling factor +float mfScale; + public: CGLayerHolder() : mpLayer(nullptr) +, mfScale(1.0) { } -CGLayerHolder(CGLayerRef pLayer) +CGLayerHolder(CGLayerRef pLayer, float fScale = 1.0) : mpLayer(pLayer) +, mfScale(fScale) { } +// Just the size of the layer in pixels +CGSize getSizePixels() const +{ +CGSize aSize; +if (mpLayer) +{ +aSize = CGLayerGetSize(mpLayer); +SAL_INFO("vcl.cg", "CGLayerGetSize(" << mpLayer << ") = " << aSize); +} +return aSize; +} + +// Size in points is size in pixels multiplied by the scaling factor +CGSize getSizePoints() const +{ +CGSize aSize; +if (mpLayer) +{ +const CGSize aLayerSize = getSizePixels(); +aSize.width = aLayerSize.width / mfScale; +aSize.height = aLayerSize.height / mfScale; +} +return aSize; +} + CGLayerRef get() const { return mpLayer; } bool isSet() const { return mpLayer != nullptr; } void set(CGLayerRef const& pLayer) { mpLayer = pLayer; } + +float getScale() { return mfScale; } + +void setScale(float fScale) { mfScale = fScale; } }; class CGContextHolder diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index dd35917cd949..05e84b98b810 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -483,48 +483,67 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, if (!maLayer.isSet()) return; #endif +float fScale = maLayer.getScale(); + +long nScaledSourceX = nSrcX * fScale; +long nScaledSourceY = nSrcY * fScale; + +long nScaledTargetX = nDstX * fScale; +long nScaledTargetY = nDstY * fScale; + +long nScaledSourceWidth = nSrcWidth * fScale; +long nScaledSourceHeight = nSrcHeight * fScale; ApplyXorContext(); +maContextHolder.saveState(); + // in XOR mode the drawing context is redirected to the XOR mask // copyArea() always works on the target context though CGContextRef xCopyContext = maContextHolder.get(); + if( mpXorEmulation && mpXorEmulation->IsEnabled() ) { xCopyContext = mpXorEmulation->GetTargetContext(); } + +// If we have a scaled layer, we need to revert the scaling or else +// it will interfere with the coordinate calculation +CGContextScaleCTM(xCopyContext, 1.0 / fScale, 1.0 / fScale); + // drawing a layer onto its own context causes trouble on OSX => copy it first // TODO: is it possible to get rid of this unneeded copy more often? //
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |6 -- vcl/quartz/ctfonts.cxx |5 ++--- vcl/quartz/salgdi.cxx |9 + 3 files changed, 15 insertions(+), 5 deletions(-) New commits: commit eb5606511fac2a8ee1af7cc03c12d6c5b16f7c96 Author: Tomaž Vajngerl AuthorDate: Sat Apr 20 21:50:37 2019 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Apr 21 01:00:48 2019 +0200 tdf#101854 Move to CommonSalLayout removed faux bold in macos Previously faux bold was drawn with setting a dictionary key kCTStrokeWidthAttributeName and a value of the stroke width. This stopped working because we don't use attributedString for drawing anymore but we always use CTFontDrawGlyphs and draw the glyphs, which doesn't have a way to set this attributes. It took me a while to find a workaround (thanks to Apple's great documentation), where we switch text drawing to fill and stroke, and after that we can modify the stroke by changing the line width. Change-Id: I594fcb9c796a9c04ea8234a9938ca2f719706199 Reviewed-on: https://gerrit.libreoffice.org/71012 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index adb5d30429ff..d04b290a8560 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -90,9 +90,11 @@ public: CFMutableDictionaryRef GetStyleDict( void ) const { return mpStyleDict; } /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0 -float mfFontStretch; +float mfFontStretch; /// text rotation in radian -float mfFontRotation; +float mfFontRotation; +/// faux bold - true, if font doesn't have proper bold variants +float mbFauxBold; private: explicit CoreTextStyle(const PhysicalFontFace&, const FontSelectPattern&); diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 5a0b5b62916d..06a25965653f 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -50,6 +50,7 @@ CoreTextStyle::CoreTextStyle(const PhysicalFontFace& rPFF, const FontSelectPatte : LogicalFontInstance(rPFF, rFSP) , mfFontStretch( 1.0 ) , mfFontRotation( 0.0 ) +, mbFauxBold(false) , mpStyleDict( nullptr ) { double fScaledFontHeight = rFSP.mfExactHeight; @@ -81,9 +82,7 @@ CoreTextStyle::CoreTextStyle(const PhysicalFontFace& rPFF, const FontSelectPatte ((rPFF.GetWeight() < WEIGHT_SEMIBOLD) && (rPFF.GetWeight() != WEIGHT_DONTKNOW)) ) { -int nStroke = -lrint((3.5F * rFSP.GetWeight()) / rPFF.GetWeight()); -CFNumberRef rStroke = CFNumberCreate(nullptr, kCFNumberSInt32Type, ); -CFDictionarySetValue(mpStyleDict, kCTStrokeWidthAttributeName, rStroke); +mbFauxBold = true; } // fake italic diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 18eda87c2de7..59e2522e58e1 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -460,6 +460,15 @@ void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) SAL_INFO("vcl.cg", "CGContextSetFillColor(" << mrContext << "," << maTextColor << ")"); CGContextSetFillColor(mrContext, maTextColor.AsArray()); +if (rStyle.mbFauxBold) +{ + +float fSize = rFontSelect.mnHeight / 23.0f; +CGContextSetStrokeColor(mrContext, maTextColor.AsArray()); +CGContextSetLineWidth(mrContext, fSize); +CGContextSetTextDrawingMode(mrContext, kCGTextFillStroke); +} + auto aIt = aGlyphOrientation.cbegin(); while (aIt != aGlyphOrientation.cend()) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |2 +- vcl/quartz/ctfonts.cxx |6 +- 2 files changed, 6 insertions(+), 2 deletions(-) New commits: commit 2f182faaf08542e381a1aee4544b47c4cd7c0b92 Author: Jan-Marek Glogowski AuthorDate: Thu Oct 4 15:54:53 2018 + Commit: Jan-Marek Glogowski CommitDate: Sat Oct 6 18:30:15 2018 +0200 OSX use font cache based glyph rect cache Change-Id: Ia9bf718f1158c68971511688fe5af3e335d841ba Reviewed-on: https://gerrit.libreoffice.org/61386 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 24b5268493de..0fb20bb490cc 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -85,7 +85,7 @@ public: ~CoreTextStyle() override; void GetFontMetric( ImplFontMetricDataRef const & ); -bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) const; +bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&); bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) const; CFMutableDictionaryRef GetStyleDict( void ) const { return mpStyleDict; } diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 6ceec8a0295d..65b3a85f5a43 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -137,8 +137,11 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) rxFontMetric->SetMinKashida(GetKashidaWidth()); } -bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect ) const +bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect ) { +if (GetCachedGlyphBoundRect(rGlyph.maGlyphId, rRect)) +return true; + CGGlyph nCGGlyph = rGlyph.maGlyphId; CTFontRef aCTFontRef = static_cast(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); @@ -156,6 +159,7 @@ bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& long xMax = ceil(aCGRect.origin.x + aCGRect.size.width); long yMax = ceil(aCGRect.origin.y + aCGRect.size.height); rRect = tools::Rectangle(xMin, -yMax, xMax, -yMin); +CacheGlyphBoundRect(rGlyph.maGlyphId, rRect); return true; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/sft.hxx |7 --- vcl/quartz/salgdi.cxx |6 +++--- vcl/quartz/salgdicommon.cxx | 12 ++-- vcl/source/fontsubset/sft.cxx | 22 +- vcl/unx/generic/fontmanager/fontmanager.cxx | 12 ++-- vcl/win/gdi/salfont.cxx | 18 +- 6 files changed, 33 insertions(+), 44 deletions(-) New commits: commit d469dca492e55798251c7f570bb730a38c32e893 Author: Noel Grandin AuthorDate: Sat Sep 15 21:14:33 2018 +0200 Commit: Noel Grandin CommitDate: Wed Sep 19 10:09:33 2018 +0200 loplugin:useuniqueptr in GetTTSimpleGlyphMetrics and only return the advance, we don't use the other field Change-Id: I956033dac97763caea2b27404fe9f099da809899 Reviewed-on: https://gerrit.libreoffice.org/60703 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index c09834adeaef..00cf119a4ca4 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -113,7 +114,7 @@ namespace vcl OVERLAP_COMPOUND = 1<<10 }; -/** Structure used by GetTTSimpleGlyphMetrics() and GetTTSimpleCharMetrics() functions */ +/** Structure used by GetTTSimpleCharMetrics() functions */ typedef struct { sal_uInt16 adv; /**< advance width or height */ sal_Int16 sb; /**< left or top sidebearing */ @@ -377,7 +378,7 @@ namespace vcl intnGlyphs); /** - * Queries glyph metrics. Allocates an array of TTSimpleGlyphMetrics structs and returns it. + * Queries glyph metrics. Allocates an array of advance width/height values and returns it. * * @param ttf pointer to the TrueTypeFont structure * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf @@ -386,7 +387,7 @@ namespace vcl * @ingroup sft * */ -TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical); +std::unique_ptr GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical); #if defined(_WIN32) || defined(MACOSX) || defined(IOS) /** diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index db595a5aa37b..43ca506220c9 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -756,15 +756,15 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV aGlyphIds[i] = static_cast(i); } -const TTSimpleGlyphMetrics* pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, [0], +std::unique_ptr pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, [0], nGlyphCount, bVertical ); if( pGlyphMetrics ) { for( int i = 0; i < nGlyphCount; ++i ) { -rGlyphWidths[i] = pGlyphMetrics[i].adv; +rGlyphWidths[i] = pGlyphMetrics[i]; } -free( const_cast(pGlyphMetrics) ); +pGlyphMetrics.reset(); } rtl::Reference rCTFontData(new CoreTextFontFace(*pFontData, pFontData->GetFontId())); diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 59d836506b52..2d952244847e 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -302,21 +302,21 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile, // fill the pGlyphWidths array // while making sure that the NotDef glyph is at index==0 -TTSimpleGlyphMetrics* pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aShortIDs, +std::unique_ptr pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aShortIDs, nGlyphCount, bVertical ); if( !pGlyphMetrics ) { return false; } -sal_uInt16 nNotDefAdv = pGlyphMetrics[0].adv; -pGlyphMetrics[0].adv = pGlyphMetrics[nNotDef].adv; -pGlyphMetrics[nNotDef].adv = nNotDefAdv; +sal_uInt16 nNotDefAdv = pGlyphMetrics[0]; +pGlyphMetrics[0] = pGlyphMetrics[nNotDef]; +pGlyphMetrics[nNotDef] = nNotDefAdv; for( int i = 0; i < nOrigCount; ++i ) { -pGlyphWidths[i] = pGlyphMetrics[i].adv; +pGlyphWidths[i] = pGlyphMetrics[i]; } -free( pGlyphMetrics ); +pGlyphMetrics.reset(); // write subset into destination file nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.getStr(), aShortIDs, diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 40a5e0bf0999..1f3634b38320 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2306,7 +2306,7 @@ bool
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/outdev.h |4 ++-- vcl/inc/unx/fontmanager.hxx|2 +- vcl/quartz/salgdi.cxx | 14 +++--- vcl/source/font/PhysicalFontCollection.cxx |2 +- vcl/unx/generic/fontmanager/fontconfig.cxx |2 +- vcl/unx/generic/fontmanager/fontsubst.cxx | 27 ++- vcl/win/gdi/salfont.cxx|8 7 files changed, 26 insertions(+), 33 deletions(-) New commits: commit fa0ea0257676d7f96938216ac958a08d7c9a364c Author: Caolán McNamara AuthorDate: Mon Aug 20 12:35:13 2018 +0100 Commit: Caolán McNamara CommitDate: Tue Aug 21 21:36:58 2018 +0200 change FindFontSubstitute to operate on FontSelectPatternAttributes it remains to be seen if we need the the returned mpFontInstance of the coretext impl Change-Id: I48f73188250c3eb014f16ffe0a735191da5cb25b Reviewed-on: https://gerrit.libreoffice.org/59322 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h index 2aabdfa93acf..5ac5cc0df0b4 100644 --- a/vcl/inc/outdev.h +++ b/vcl/inc/outdev.h @@ -110,7 +110,7 @@ class ImplPreMatchFontSubstitution : public ImplFontSubstitution { public: -virtual bool FindFontSubstitute( FontSelectPattern& ) const = 0; +virtual bool FindFontSubstitute(FontSelectPatternAttributes&) const = 0; }; // ImplGlyphFallbackFontSubstitution @@ -119,7 +119,7 @@ class ImplGlyphFallbackFontSubstitution : public ImplFontSubstitution { public: -virtual bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingCodes ) const = 0; +virtual bool FindFontSubstitute(FontSelectPatternAttributes&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const = 0; }; namespace vcl { struct ControlLayoutData; } diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index fcaf801018c4..bdd2c9e1a850 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -310,7 +310,7 @@ public: void matchFont( FastPrintFontInfo& rInfo, const css::lang::Locale& rLocale ); static FontConfigFontOptions* getFontOptions( const FastPrintFontInfo&, int nSize); -void Substitute( FontSelectPattern , OUString& rMissingCodes ); +void Substitute(FontSelectPatternAttributes , OUString& rMissingCodes); }; diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 3f74e05f5910..6b9350bb4427 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -60,14 +60,14 @@ class CoreTextGlyphFallbackSubstititution :public ImplGlyphFallbackFontSubstitution { public: -bool FindFontSubstitute(FontSelectPattern&, OUString&) const override; +bool FindFontSubstitute(FontSelectPatternAttributes&, LogicalFontInstance* pLogicalFont, OUString&) const override; }; -bool CoreTextGlyphFallbackSubstititution::FindFontSubstitute(FontSelectPattern& rPattern, +bool CoreTextGlyphFallbackSubstititution::FindFontSubstitute(FontSelectPatternAttributes& rPattern, LogicalFontInstance* pLogicalFont, OUString& rMissingChars) const { bool bFound = false; -CoreTextStyle* pStyle = static_cast(rPattern.mpFontInstance.get()); +CoreTextStyle* pStyle = static_cast(pLogicalFont); CTFontRef pFont = static_cast(CFDictionaryGetValue(pStyle->GetStyleDict(), kCTFontAttributeName)); CFStringRef pStr = CreateCFString(rMissingChars); if (pStr) @@ -87,14 +87,6 @@ bool CoreTextGlyphFallbackSubstititution::FindFontSubstitute(FontSelectPattern& rPattern.SetPitch(rAttr.GetPitch()); rPattern.SetWidthType(rAttr.GetWidthType()); -SalData* pSalData = GetSalData(); -if (pSalData->mpFontList) -{ -const CoreTextFontFace *pFontFace = pSalData->mpFontList->GetFontDataFromId(reinterpret_cast(pDesc)); -if (pFontFace) -rPattern.mpFontInstance = pFontFace->CreateFontInstance(rPattern); -} - CFRelease(pFallback); CFRelease(pDesc); } diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index 38dedaf09645..77bbfd57a061 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -216,7 +216,7 @@ PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont( FontSelectPatt OUString aOldMissingCodes = rMissingCodes; // call the hook to query the best matching glyph fallback font -if( mpFallbackHook->FindFontSubstitute( rFontSelData, rMissingCodes ) ) +if (mpFallbackHook->FindFontSubstitute(rFontSelData, rFontSelData.mpFontInstance.get(), rMissingCodes)) // apply outdev3.cxx specific fontname normalization rFontSelData.maSearchName = GetEnglishSearchFontName( rFontSelData.maSearchName );
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/utils.h |2 +- vcl/quartz/utils.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit fa7ebc82bbcee15cd75b42d1e7b8ef66ed719225 Author: Tor Lillqvist Date: Wed Jun 27 16:38:55 2018 +0300 This should be a const NSString* so that we can pass such variables to it Change-Id: I017c100f83faac64ad3a8430010c226b438e6a07 Reviewed-on: https://gerrit.libreoffice.org/56529 Tested-by: Jenkins Reviewed-by: Tor Lillqvist diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h index 57a0402bc644..2452c151d28e 100644 --- a/vcl/inc/quartz/utils.h +++ b/vcl/inc/quartz/utils.h @@ -35,7 +35,7 @@ #include OUString GetOUString( CFStringRef ); -OUString GetOUString( NSString* ); +OUString GetOUString( const NSString* ); CFStringRef CreateCFString( const OUString& ); NSString* CreateNSString( const OUString& ); diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx index 2a65acd0af2f..80c773889d2d 100644 --- a/vcl/quartz/utils.cxx +++ b/vcl/quartz/utils.cxx @@ -55,7 +55,7 @@ OUString GetOUString( CFStringRef rStr ) return aRet; } -OUString GetOUString( NSString* pStr ) +OUString GetOUString( const NSString* pStr ) { if( ! pStr ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/sft.hxx | 36 ++-- vcl/quartz/salgdi.cxx |4 - vcl/quartz/salgdicommon.cxx |6 +- vcl/source/font/font.cxx|2 vcl/source/fontsubset/fontsubset.cxx|4 - vcl/source/fontsubset/sft.cxx | 79 ++-- vcl/source/fontsubset/ttcr.cxx | 22 +++ vcl/source/fontsubset/ttcr.hxx |8 +- vcl/source/gdi/embeddedfontshelper.cxx |2 vcl/unx/generic/fontmanager/fontmanager.cxx |8 +- vcl/unx/generic/print/glyphset.cxx |4 - vcl/win/gdi/salfont.cxx | 14 ++-- 12 files changed, 95 insertions(+), 94 deletions(-) New commits: commit d4992bb36efb15da91a70e86e68a80f13b97e947 Author: Stephan Bergmann Date: Tue May 29 12:00:11 2018 +0200 Change SFErrCodes to scoped enum Change-Id: Ib2f267397e419e8164bb2d732f7cbcca7acad1a6 Reviewed-on: https://gerrit.libreoffice.org/54996 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 1888f8bf79f6..c4bdee9f2a76 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -61,16 +61,16 @@ namespace vcl /*@}*/ /** Return value of OpenTTFont() and CreateT3FromTTGlyphs() */ -enum SFErrCodes { -SF_OK, /**< no error */ -SF_BADFILE, /**< file not found */ -SF_FILEIO, /**< file I/O error */ -SF_MEMORY, /**< memory allocation error */ -SF_GLYPHNUM,/**< incorrect number of glyphs */ -SF_BADARG, /**< incorrect arguments */ -SF_TTFORMAT,/**< incorrect TrueType font format */ -SF_TABLEFORMAT, /**< incorrect format of a TrueType table */ -SF_FONTNO /**< incorrect logical font number of a TTC font */ +enum class SFErrCodes { +Ok, /**< no error */ +BadFile, /**< file not found */ +FileIo, /**< file I/O error */ +Memory, /**< memory allocation error */ +GlyphNum,/**< incorrect number of glyphs */ +BadArg, /**< incorrect arguments */ +TtFormat,/**< incorrect TrueType font format */ +TableFormat, /**< incorrect format of a TrueType table */ +FontNo /**< incorrect logical font number of a TTC font */ }; #ifndef FW_THIN /* WIN32 compilation would conflict */ @@ -213,7 +213,7 @@ namespace vcl * @return value of SFErrCodes enum * @ingroup sft */ -int VCL_DLLPUBLIC OpenTTFontBuffer(const void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont** ttf); +SFErrCodes VCL_DLLPUBLIC OpenTTFontBuffer(const void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont** ttf); #if !defined(_WIN32) /** * TrueTypeFont constructor. @@ -226,7 +226,7 @@ namespace vcl * @return value of SFErrCodes enum * @ingroup sft */ -int VCL_DLLPUBLIC OpenTTFontFile(const char *fname, sal_uInt32 facenum, TrueTypeFont** ttf); +SFErrCodes VCL_DLLPUBLIC OpenTTFontFile(const char *fname, sal_uInt32 facenum, TrueTypeFont** ttf); #endif bool VCL_DLLPUBLIC getTTCoverage( @@ -326,7 +326,7 @@ namespace vcl * @ingroup sft * */ -int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 *encoding, int nGlyphs, int wmode); +SFErrCodes CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 *encoding, int nGlyphs, int wmode); /** * Generates a new TrueType font and dumps it to outf file. @@ -345,7 +345,7 @@ namespace vcl * @ingroup sft * */ -int CreateTTFromTTGlyphs(TrueTypeFont *ttf, +SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont *ttf, const char*fname, sal_uInt16 const *glyphArray, sal_uInt8 const *encoding, @@ -363,15 +363,15 @@ namespace vcl *the glyphID glyphArray[i]. Character code 0 usually points to a default *glyph (glyphID 0) * @param nGlyphs number of glyph IDs in glyphArray and encoding values in
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/sallayout.hxx| 12 +-- vcl/quartz/salgdi.cxx|2 vcl/source/gdi/pdfwriter_impl.cxx|6 - vcl/source/gdi/sallayout.cxx | 100 +-- vcl/source/outdev/font.cxx |2 vcl/source/outdev/text.cxx |2 vcl/source/outdev/textline.cxx |2 vcl/unx/generic/gdi/cairotextrender.cxx |2 vcl/unx/generic/print/genpspgraphics.cxx |2 vcl/win/gdi/DWriteTextRenderer.cxx |2 vcl/win/gdi/winlayout.cxx|6 - 11 files changed, 49 insertions(+), 89 deletions(-) New commits: commit 5441727c29fba37dff85e465ec55ead5942d8232 Author: Khaled HosnyDate: Tue Apr 24 15:55:34 2018 +0200 Simplify and rename SalLayout::GetNextGlyphs It is now always called with nLen == 1, so simplify and rename. The criteria for deciding how many glyphs to return was bogus anyway, good riddance. Change-Id: Iff578d124ab40a0dfa84469be8e0e9fc1b6b8c48 Reviewed-on: https://gerrit.libreoffice.org/53406 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 0ab317dae03f..170c2a2c380d 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -173,8 +173,8 @@ public: virtual boolIsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594 // methods using glyph indexing -virtual int GetNextGlyphs(int nLen, const GlyphItem** pGlyphs, Point& rPos, int&, - const PhysicalFontFace** pFallbackFonts = nullptr) const = 0; +virtual boolGetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int&, + const PhysicalFontFace** pFallbackFont = nullptr) const = 0; virtual boolGetOutline( SalGraphics&, basegfx::B2DPolyPolygonVector& ) const; virtual boolGetBoundRect( SalGraphics&, tools::Rectangle& ) const; @@ -214,8 +214,8 @@ public: virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const override; virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) const override; -virtual int GetNextGlyphs(int nLen, const GlyphItem** pGlyphs, Point& rPos, int&, - const PhysicalFontFace** pFallbackFonts = nullptr) const override; +virtual boolGetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int&, + const PhysicalFontFace** pFallbackFont = nullptr) const override; virtual boolGetOutline( SalGraphics&, basegfx::B2DPolyPolygonVector& ) const override; virtual boolIsKashidaPosValid(int nCharPos) const override; @@ -316,8 +316,8 @@ public: virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) const override; // used by display layers -virtual int GetNextGlyphs(int nLen, const GlyphItem** pGlyphs, Point& rPos, int&, - const PhysicalFontFace** pFallbackFonts = nullptr) const override; +virtual boolGetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int&, + const PhysicalFontFace** pFallbackFont = nullptr) const override; protected: GenericSalLayout(); diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 7ee45db62aef..ed0d4b78d9d1 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -418,7 +418,7 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) std::vector aGlyphPos; std::vector aGlyphOrientation; int nStart = 0; -while (rLayout.GetNextGlyphs(1, , aPos, nStart)) +while (rLayout.GetNextGlyph(, aPos, nStart)) { CGPoint aGCPos = CGPointMake(aPos.X(), -aPos.Y()); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 3b7b2a84d3af..de4872342db7 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6673,7 +6673,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool aGlyphs.reserve( nMaxGlyphs ); // first get all the glyphs and register them; coordinates still in Pixel Point aPos; -while (rLayout.GetNextGlyphs(1, , aPos, nIndex, )) +while (rLayout.GetNextGlyph(, aPos, nIndex, )) { const auto* pFont = pFallbackFont ? pFallbackFont : pDevFont; @@ -6791,7 +6791,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool Point aStartPt; sal_Int32 nWidth = 0; nIndex = 0; -while (rLayout.GetNextGlyphs(1, , aPos, nIndex)) +while (rLayout.GetNextGlyph(, aPos, nIndex)) {
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |3 +-- vcl/quartz/ctfonts.cxx | 14 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) New commits: commit 43836528f445061d622b8edc7773ee40798d3a59 Author: Tor LillqvistDate: Mon Jan 22 20:57:24 2018 +0200 The CT prefix is used by the CoreText API Surely we should not be using it for our own things in our Quartz code, that is misleading. Also bin a silly typedef. Change-Id: Ie932e8784128246ca449608aad3dc96a575ec9d5 diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 17faec998c26..4016fcb4a2cc 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -126,8 +126,7 @@ private: CTFontCollectionRef mpCTFontCollection; CFArrayRef mpCTFontArray; -typedef std::unordered_map CTFontContainer; -CTFontContainer maFontContainer; +std::unordered_map maFontContainer; }; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index b7389c895568..fbdf2efe89a3 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -441,7 +441,7 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont return rDFA; } -static void CTFontEnumCallBack( const void* pValue, void* pContext ) +static void fontEnumCallBack( const void* pValue, void* pContext ) { CTFontDescriptorRef pFD = static_cast(pValue); @@ -464,8 +464,8 @@ SystemFontList::SystemFontList() SystemFontList::~SystemFontList() { -CTFontContainer::const_iterator it = maFontContainer.begin(); -for(; it != maFontContainer.end(); ++it ) +auto it = maFontContainer.cbegin(); +for(; it != maFontContainer.cend(); ++it ) { delete (*it).second; } @@ -489,8 +489,8 @@ void SystemFontList::AddFont( CoreTextFontFace* pFontData ) void SystemFontList::AnnounceFonts( PhysicalFontCollection& rFontCollection ) const { -CTFontContainer::const_iterator it = maFontContainer.begin(); -for(; it != maFontContainer.end(); ++it ) +auto it = maFontContainer.cbegin(); +for(; it != maFontContainer.cend(); ++it ) { rFontCollection.Add( (*it).second->Clone() ); } @@ -498,7 +498,7 @@ void SystemFontList::AnnounceFonts( PhysicalFontCollection& rFontCollection ) co CoreTextFontFace* SystemFontList::GetFontDataFromId( sal_IntPtr nFontId ) const { -CTFontContainer::const_iterator it = maFontContainer.find( nFontId ); +auto it = maFontContainer.find( nFontId ); if( it == maFontContainer.end() ) { return nullptr; @@ -522,7 +522,7 @@ bool SystemFontList::Init() const int nFontCount = CFArrayGetCount( mpCTFontArray ); const CFRange aFullRange = CFRangeMake( 0, nFontCount ); -CFArrayApplyFunction( mpCTFontArray, aFullRange, CTFontEnumCallBack, this ); +CFArrayApplyFunction( mpCTFontArray, aFullRange, fontEnumCallBack, this ); return true; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/fontsubset.hxx | 34 ++ vcl/quartz/salgdicommon.cxx |6 ++-- vcl/source/fontsubset/cff.cxx |4 +-- vcl/source/fontsubset/fontsubset.cxx| 36 ++-- vcl/source/gdi/pdfwriter_impl.cxx | 18 +++--- vcl/unx/generic/fontmanager/fontmanager.cxx |6 ++-- vcl/unx/generic/print/glyphset.cxx |4 +-- vcl/win/gdi/salfont.cxx |6 ++-- 8 files changed, 59 insertions(+), 55 deletions(-) New commits: commit eecf39c6e44e25a5a78aa7b435d07a9c53c628c4 Author: Noel GrandinDate: Wed Feb 8 13:32:40 2017 +0200 convert FontType to scoped enum Change-Id: Ieb8f90be8effde5f25bc872784c3ea2177b14bf9 Reviewed-on: https://gerrit.libreoffice.org/34056 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx index 11f5810..58cdb1e 100644 --- a/vcl/inc/fontsubset.hxx +++ b/vcl/inc/fontsubset.hxx @@ -22,35 +22,39 @@ #include #include +#include #include "salglyphid.hxx" namespace vcl { struct TrueTypeFont; } ///< SFT's idea of a TTF font +enum class FontType { +NO_FONT = 0, +SFNT_TTF= 1<<1, ///< SFNT container with TrueType glyphs +SFNT_CFF= 1<<2, ///< SFNT container with CFF-container +TYPE1_PFA = 1<<3, ///< PSType1 Postscript Font Ascii +TYPE1_PFB = 1<<4, ///< PSType1 Postscript Font Binary +CFF_FONT= 1<<5, ///< CFF-container with PSType2 glyphs +TYPE3_FONT = 1<<6, ///< PSType3 Postscript font +TYPE42_FONT = 1<<7, ///< PSType42 wrapper for an SFNT_TTF +ANY_SFNT= SFNT_TTF | SFNT_CFF, +ANY_TYPE1 = TYPE1_PFA | TYPE1_PFB +}; +namespace o3tl { +template<> struct typed_flags : is_typed_flags {}; +} + class FontSubsetInfo final { public: explicitFontSubsetInfo(); ~FontSubsetInfo(); -enum FontType { -NO_FONT = 0, -SFNT_TTF= 1<<1, ///< SFNT container with TrueType glyphs -SFNT_CFF= 1<<2, ///< SFNT container with CFF-container -TYPE1_PFA = 1<<3, ///< PSType1 Postscript Font Ascii -TYPE1_PFB = 1<<4, ///< PSType1 Postscript Font Binary -CFF_FONT= 1<<5, ///< CFF-container with PSType2 glyphs -TYPE3_FONT = 1<<6, ///< PSType3 Postscript font -TYPE42_FONT = 1<<7, ///< PSType42 wrapper for an SFNT_TTF -ANY_SFNT= SFNT_TTF | SFNT_CFF, -ANY_TYPE1 = TYPE1_PFA | TYPE1_PFB -}; - boolLoadFont( FontType eInFontType, const unsigned char* pFontBytes, int nByteLength ); boolLoadFont( vcl::TrueTypeFont* pSftTrueTypeFont ); -boolCreateFontSubset( int nOutFontTypeMask, +boolCreateFontSubset( FontType nOutFontTypeMask, FILE* pOutFile, const char* pOutFontName, const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncodedIds, int nReqGlyphCount, sal_Int32* pOutGlyphWidths = nullptr ); @@ -72,7 +76,7 @@ private: vcl::TrueTypeFont* mpSftTTFont; // subset-request details -int mnReqFontTypeMask; ///< allowed subset-target font types +FontTypemnReqFontTypeMask; ///< allowed subset-target font types FILE* mpOutFile; const char* mpReqFontName; const sal_GlyphId* mpReqGlyphIds; diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index db14e36..b472a49 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -208,13 +208,13 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile, { // provide the raw-CFF data to the subsetter ByteCount nCffLen = aBuffer.size(); -rInfo.LoadFont( FontSubsetInfo::CFF_FONT, [0], nCffLen ); +rInfo.LoadFont( FontType::CFF_FONT, [0], nCffLen ); // NOTE: assuming that all glyphids requested on Aqua are fully translated // make the subsetter provide the requested subset FILE* pOutFile = fopen( aToFile.getStr(), "wb" ); -bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, nullptr, +bool bRC = rInfo.CreateFontSubset( FontType::TYPE1_PFB, pOutFile, nullptr, pGlyphIds, pEncoding, nGlyphCount, pGlyphWidths ); fclose( pOutFile ); return bRC; @@ -234,7 +234,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString&
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/sft.hxx | 23 +--- vcl/quartz/salgdicommon.cxx |2 - vcl/source/fontsubset/sft.cxx | 50 +++- vcl/unx/generic/fontmanager/fontmanager.cxx |3 - vcl/win/gdi/salfont.cxx |2 - 5 files changed, 13 insertions(+), 67 deletions(-) New commits: commit eb1352bb40b3571ee215d6f8bf0c8a0a85297aa4 Author: Noel GrandinDate: Wed Feb 8 12:31:17 2017 +0200 drop unused enum TTCreationFlags there is only one method using it, and all of the call sites pass 0 Change-Id: I5d71b36cf890fbcf0be9d795756da0cfd61ae309 Reviewed-on: https://gerrit.libreoffice.org/34024 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 91c13a3..a694391 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -122,22 +122,6 @@ namespace vcl OVERLAP_COMPOUND = 1<<10 }; -/** Flags for TrueType generation */ -enum TTCreationFlags { -TTCF_AutoName = 1, /**< Automatically generate a compact 'name' table. - If this flag is not set, name table is generated - either from an array of NameRecord structs passed as - arguments or if the array is NULL, 'name' table - of the generated TrueType file will be a copy - of the name table of the original file. - If this flag is set the array of NameRecord structs - is ignored and a very compact 'name' table is automatically - generated. */ - -TTCF_IncludeOS2 = 2 /** If this flag is set OS/2 table from the original font will be -copied to the subset */ -}; - /** Structure used by GetTTSimpleGlyphMetrics() and GetTTSimpleCharMetrics() functions */ typedef struct { sal_uInt16 adv; /**< advance width or height */ @@ -390,12 +374,11 @@ namespace vcl */ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, const char*fname, - sal_uInt16*glyphArray, - sal_uInt8 *encoding, + sal_uInt16*glyphArray, + sal_uInt8 *encoding, intnGlyphs, intnNameRecs, - NameRecord*nr, - sal_uInt32flags); + NameRecord*nr); /** * Generates a new PostScript Type42 font and dumps it to outf file. diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 0d213da..db14e36 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -319,7 +319,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile, // write subset into destination file nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.getStr(), aShortIDs, - aTempEncs, nGlyphCount, 0, nullptr, 0 ); + aTempEncs, nGlyphCount, 0, nullptr ); ::CloseTTFont(pSftFont); return (nRC == SF_OK); } diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index c4c9e69..edc08d2 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1944,8 +1944,7 @@ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, sal_uInt8 *encoding, intnGlyphs, intnNameRecs, - NameRecord*nr, - sal_uInt32flags) + NameRecord*nr) { TrueTypeCreator *ttcr; TrueTypeTable *head=nullptr, *hhea=nullptr, *maxp=nullptr, *cvt=nullptr, *prep=nullptr, *glyf=nullptr, *fpgm=nullptr, *cmap=nullptr, *name=nullptr, *post = nullptr, *os2 = nullptr; @@ -1956,42 +1955,13 @@ int CreateTTFromTTGlyphs(TrueTypeFont *ttf, /** name **/ -if (flags & TTCF_AutoName) { -/* not implemented yet - NameRecord *names; - NameRecord newname; - int n = GetTTNameRecords(ttf, ); - int n1 = 0, n2 = 0, n3 = 0, n4 = 0, n5 = 0, n6 = 0; - sal_uInt8 *cp1; - sal_uInt8 suffix[32]; - sal_uInt32 c1 = crc32(glyphArray, nGlyphs * 2); - sal_uInt32 c2 =
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salbmp.h |2 +- vcl/quartz/salbmp.cxx | 10 +- vcl/quartz/salgdicommon.cxx |2 +- 3 files changed, 11 insertions(+), 3 deletions(-) New commits: commit 8145a80868aeb2d81abdeb2918942911c6d128f4 Author: Thorsten BehrensDate: Sat Dec 31 18:01:14 2016 +0100 tdf#104693: screenshot: fix mirrored mac screenshots Change-Id: Ie13689d7e15bf8dee6f21e6f5e7d75c9e53e931b Reviewed-on: https://gerrit.libreoffice.org/32543 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h index ae384c9..5fe1294 100644 --- a/vcl/inc/quartz/salbmp.h +++ b/vcl/inc/quartz/salbmp.h @@ -88,7 +88,7 @@ private: sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData ); public: -boolCreate( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight ); +boolCreate( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight, bool bFlipped ); public: CGImageRef CreateWithMask( const QuartzSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const; diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index dc9b683..014dd34 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -107,7 +107,7 @@ QuartzSalBitmap::~QuartzSalBitmap() } bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits, -int nX, int nY, int nWidth, int nHeight ) +int nX, int nY, int nWidth, int nHeight, bool bFlipped ) { SAL_WARN_IF( !xLayer, "vcl", "QuartzSalBitmap::Create() from non-layered context" ); @@ -146,6 +146,14 @@ bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits, if(mxGraphicContext) // remove warning { SAL_INFO("vcl.cg", "CGContextDrawLayerAtPoint(" << mxGraphicContext << "," << aSrcPoint << "," << xLayer << ")" ); +if( bFlipped ) +{ +SAL_INFO( "vcl.cg", "CGContextTranslateCTM(" << mxGraphicContext << ",0," << mnHeight << ")" ); +CGContextTranslateCTM( mxGraphicContext, 0, +mnHeight ); +SAL_INFO( "vcl.cg", "CGContextScaleCTM(" << mxGraphicContext << ",+1,-1)" ); +CGContextScaleCTM( mxGraphicContext, +1, -1 ); +} + CGContextDrawLayerAtPoint( mxGraphicContext, aSrcPoint, xLayer ); } return true; diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index e06..0d213da 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -1448,7 +1448,7 @@ SalBitmap* AquaSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ApplyXorContext(); QuartzSalBitmap* pBitmap = new QuartzSalBitmap; -if( !pBitmap->Create( mxLayer, mnBitmapDepth, nX, nY, nDX, nDY) ) +if( !pBitmap->Create( mxLayer, mnBitmapDepth, nX, nY, nDX, nDY, IsFlipped()) ) { delete pBitmap; pBitmap = nullptr; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/salglyphid.hxx |4 vcl/quartz/ctfonts.cxx |4 ++-- vcl/quartz/salgdi.cxx |2 +- vcl/quartz/salgdicommon.cxx|2 +- vcl/source/gdi/pdffontcache.cxx|6 ++ vcl/source/gdi/pdfwriter_impl.cxx |2 +- vcl/source/gdi/sallayout.cxx |9 + vcl/source/outdev/text.cxx |2 +- vcl/unx/generic/gdi/cairotextrender.cxx|2 +- vcl/unx/generic/glyphs/freetype_glyphcache.cxx |4 ++-- vcl/unx/generic/glyphs/glyphcache.cxx |4 ++-- vcl/win/gdi/salfont.cxx| 23 ++- vcl/win/gdi/winlayout.cxx |6 +++--- 13 files changed, 23 insertions(+), 47 deletions(-) New commits: commit a597dc833966aba23d4b677e5bcd6f74b979fc9d Author: Khaled HosnyDate: Thu Dec 8 05:57:40 2016 +0200 sal_GlyphId is a simple glyph id now No more cleverness. Change-Id: I760c602802961b37728c6987c4ade14fb02ca034 Reviewed-on: https://gerrit.libreoffice.org/31819 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/inc/salglyphid.hxx b/vcl/inc/salglyphid.hxx index 72cf4fc..6d5480e 100644 --- a/vcl/inc/salglyphid.hxx +++ b/vcl/inc/salglyphid.hxx @@ -19,13 +19,9 @@ #ifndef INCLUDED_VCL_INC_SALGLYPHID_HXX #define INCLUDED_VCL_INC_SALGLYPHID_HXX -// TODO: sal_GlyphId should become a class... typedef sal_uInt32 sal_GlyphId; // Glyph Flags -#define GF_FLAGMASK 0xFF80 -#define GF_IDXMASK ~GF_FLAGMASK - #ifdef _WIN32 // caution !!! #define GF_VERT 0x0200 diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 52062eb..f5ea6db 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -154,7 +154,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect ) const { -CGGlyph nCGGlyph = rGlyph.maGlyphId & GF_IDXMASK; +CGGlyph nCGGlyph = rGlyph.maGlyphId; CTFontRef aCTFontRef = static_cast(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.11 kCTFontDefaultOrientation @@ -229,7 +229,7 @@ bool CoreTextStyle::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPol { rResult.clear(); -CGGlyph nCGGlyph = rGlyph.maGlyphId & GF_IDXMASK; +CGGlyph nCGGlyph = rGlyph.maGlyphId; CTFontRef pCTFont = static_cast(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); CGPathRef xPath = CTFontCreatePathForGlyph( pCTFont, nCGGlyph, nullptr ); if (!xPath) diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 0df8955..e38f5d2 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -442,7 +442,7 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) } } -aGlyphIds.push_back(pGlyph->maGlyphId & GF_IDXMASK); +aGlyphIds.push_back(pGlyph->maGlyphId); aGlyphPos.push_back(aGCPos); aGlyphOrientation.push_back(bUprightGlyph); } diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 57a930a..e06 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -274,7 +274,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile, { aTempEncs[i] = pEncoding[i]; -sal_GlyphId aGlyphId(pGlyphIds[i] & GF_IDXMASK); +sal_GlyphId aGlyphId(pGlyphIds[i]); aShortIDs[i] = static_cast( aGlyphId ); if( !aGlyphId && nNotDef < 0 ) { diff --git a/vcl/source/gdi/pdffontcache.cxx b/vcl/source/gdi/pdffontcache.cxx index 8140db7..67a8614 100644 --- a/vcl/source/gdi/pdffontcache.cxx +++ b/vcl/source/gdi/pdffontcache.cxx @@ -58,10 +58,8 @@ sal_Int32 PDFFontCache::getGlyphWidth( const PhysicalFontFace* pFont, sal_GlyphI } if( ! rFontData.m_nWidths.empty() ) { -sal_GlyphId nIndex = nGlyph; -nIndex &= GF_IDXMASK; -if( nIndex < rFontData.m_nWidths.size() ) -nWidth = rFontData.m_nWidths[ nIndex ]; +if (nGlyph < rFontData.m_nWidths.size()) +nWidth = rFontData.m_nWidths[nGlyph]; } return nWidth; } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index ab05594..241324d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -8144,7 +8144,7 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs, sal_Ucs* pCurUnicode = pUnicodes; for( int i = 0; i < nGlyphs; pCurUnicode += pUnicodesPerGlyph[i] , i++ ) { -const int nFontGlyphId = pGlyphs[i]->maGlyphId & GF_IDXMASK; +const int nFontGlyphId = pGlyphs[i]->maGlyphId; const PhysicalFontFace* pCurrentFont = pFallbackFonts[i] ? pFallbackFonts[i] :
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx
vcl/inc/sallayout.hxx|5 + vcl/quartz/salgdi.cxx|4 ++-- vcl/source/gdi/sallayout.cxx |4 ++-- vcl/source/outdev/text.cxx |2 +- vcl/unx/generic/gdi/cairotextrender.cxx |4 ++-- vcl/unx/generic/print/genpspgraphics.cxx |4 ++-- 6 files changed, 14 insertions(+), 9 deletions(-) New commits: commit 0fb0a564bf9cb0f721e812ac4bfa70e951827bdd Author: Khaled HosnyDate: Thu Dec 8 05:38:08 2016 +0200 Donât encode font fallback level in the glyph id Change-Id: I747d969c3c1dc42b1a3b5d12d06fed3af9a64675 Reviewed-on: https://gerrit.libreoffice.org/31818 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 9e7f8ab..ee41051 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -279,6 +279,8 @@ struct GlyphItem sal_GlyphId maGlyphId; Point maLinearPos;// absolute position of non rotated string +int mnFallbackLevel; + public: GlyphItem() : mnFlags(0) @@ -287,6 +289,7 @@ public: , mnNewWidth(0) , mnXOffset(0) , maGlyphId(0) +, mnFallbackLevel(0) { } GlyphItem( int nCharPos, sal_GlyphId aGlyphId, const Point& rLinearPos, @@ -298,6 +301,7 @@ public: , mnXOffset(0) , maGlyphId(aGlyphId) , maLinearPos(rLinearPos) +, mnFallbackLevel(0) { } GlyphItem( int nCharPos, sal_GlyphId aGlyphId, const Point& rLinearPos, @@ -309,6 +313,7 @@ public: , mnXOffset(nXOffset) , maGlyphId(aGlyphId) , maLinearPos(rLinearPos) +, mnFallbackLevel(0) { } enum { diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index c8f9c75..0df8955 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -384,7 +384,7 @@ bool AquaSalGraphics::AddTempDevFont( PhysicalFontCollection*, bool AquaSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rPolyPoly) { -const int nFallbackLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; +const int nFallbackLevel = rGlyph.mnFallbackLevel; if (nFallbackLevel < MAX_FALLBACK && mpTextStyle[nFallbackLevel]) { const bool bRC = mpTextStyle[nFallbackLevel]->GetGlyphOutline(rGlyph, rPolyPoly); @@ -395,7 +395,7 @@ bool AquaSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyP bool AquaSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect ) { -const int nFallbackLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; +const int nFallbackLevel = rGlyph.mnFallbackLevel; if (nFallbackLevel < MAX_FALLBACK && mpTextStyle[nFallbackLevel]) { const bool bRC = mpTextStyle[nFallbackLevel]->GetGlyphBoundRect(rGlyph, rRect); diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 9c4c48f..bdbb28d 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1610,8 +1610,8 @@ int MultiSalLayout::GetNextGlyphs(int nLen, const GlyphItem** pGlyphs, nStart |= nFontTag; for( int i = 0; i < nRetVal; ++i ) { -// FIXME: This is ugly! -const_cast (pGlyphs[i])->maGlyphId |= nFontTag; +// FIXME: This cast is ugly! +const_cast (pGlyphs[i])->mnFallbackLevel = nLevel; if( pFallbackFonts ) { pFallbackFonts[ i ] = mpFallbackFonts[ nLevel ]; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 93deefe..2d66822 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -2397,7 +2397,7 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c aSystemGlyph.index = static_cast (pGlyph->maGlyphId & GF_IDXMASK); aSystemGlyph.x = aPos.X(); aSystemGlyph.y = aPos.Y(); -int nLevel = (pGlyph->maGlyphId & GF_FONTMASK) >> GF_FONTSHIFT; +int nLevel = pGlyph->mnFallbackLevel; aSystemGlyph.fallbacklevel = nLevel < MAX_FALLBACK ? nLevel : 0; aSysLayoutData.rGlyphData.push_back(aSystemGlyph); } diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index a188ad3..ec025b8 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -427,7 +427,7 @@ void CairoTextRender::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nF bool CairoTextRender::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect) { -const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; +const int nLevel = rGlyph.mnFallbackLevel; if( nLevel >= MAX_FALLBACK )
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/salglyphid.hxx |4 --- vcl/inc/sallayout.hxx |2 + vcl/inc/unx/glyphcache.hxx |2 - vcl/quartz/ctfonts.cxx |4 +-- vcl/quartz/salgdi.cxx |2 - vcl/source/gdi/CommonSalLayout.cxx |2 - vcl/source/gdi/pdfwriter_impl.cxx | 18 +++-- vcl/source/gdi/pdfwriter_impl.hxx |7 +++-- vcl/unx/generic/gdi/cairotextrender.cxx| 13 +++-- vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 33 +++-- vcl/unx/generic/print/text_gfx.cxx |2 - vcl/win/gdi/winlayout.cxx |6 ++-- 12 files changed, 34 insertions(+), 61 deletions(-) New commits: commit 57d248bcec3c6ae3fa1a943a9fd92c566239787f Author: Khaled HosnyDate: Thu Dec 8 04:39:16 2016 +0200 Donât encode the vertical flag in the glyph id Change-Id: I00485dd4d42004e4eaa163a9e6ad0a43cf98a30a Reviewed-on: https://gerrit.libreoffice.org/31816 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/inc/salglyphid.hxx b/vcl/inc/salglyphid.hxx index dbfd95e..72cf4fc 100644 --- a/vcl/inc/salglyphid.hxx +++ b/vcl/inc/salglyphid.hxx @@ -23,10 +23,8 @@ typedef sal_uInt32 sal_GlyphId; // Glyph Flags -#define GF_NONE 0x #define GF_FLAGMASK 0xFF80 #define GF_IDXMASK ~GF_FLAGMASK -#define GF_ROTL 0x0100 #ifdef _WIN32 // caution !!! @@ -36,8 +34,6 @@ typedef sal_uInt32 sal_GlyphId; // don't use this elsewhere !!! #endif -#define GF_ROTR 0x0300 -#define GF_ROTMASK 0x0300 #define GF_FONTMASK 0xF000 #define GF_FONTSHIFT 28 diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 2703f2d..9e7f8ab 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -315,12 +315,14 @@ public: IS_IN_CLUSTER = 0x001, IS_RTL_GLYPH = 0x002, IS_DIACRITIC = 0x004, +IS_VERTICAL = 0x008, ALLOW_KASHIDA = 0X010 }; boolIsClusterStart() const { return ((mnFlags & IS_IN_CLUSTER) == 0); } boolIsRTLGlyph() const { return ((mnFlags & IS_RTL_GLYPH) != 0); } boolIsDiacritic() const { return ((mnFlags & IS_DIACRITIC) != 0); } +boolIsVertical() const { return ((mnFlags & IS_VERTICAL) != 0); } boolAllowKashida() const{ return ((mnFlags & ALLOW_KASHIDA) != 0); } }; diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index bf9cf3c..36155d7 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -179,7 +179,7 @@ private: voidGarbageCollect( long ); voidReleaseFromGarbageCollect(); -voidApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_* ) const; +voidApplyGlyphTransform(bool bVertical, FT_Glyph) const; typedef std::unordered_map GlyphList; mutable GlyphList maGlyphList; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 300ee4d..52062eb 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -162,8 +162,8 @@ bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect SAL_WNODEPRECATED_DECLARATIONS_POP CGRect aCGRect = CTFontGetBoundingRectsForGlyphs(aCTFontRef, aFontOrientation, , nullptr, 1); -// Apply font rotation to non-upright glyphs. -if (mfFontRotation && !(rGlyph.maGlyphId & GF_ROTMASK)) +// Apply font rotation to non-vertical glyphs. +if (mfFontRotation && !rGlyph.IsVertical()) aCGRect = CGRectApplyAffineTransform(aCGRect, CGAffineTransformMakeRotation(mfFontRotation)); rRect.Left() = lrint( aCGRect.origin.x ); diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index c593b88..c8f9c75 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -429,7 +429,7 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) if (rStyle.mfFontRotation) { -if ((pGlyph->maGlyphId & GF_ROTMASK) == GF_ROTL) +if (pGlyph->IsVertical()) { bUprightGlyph = true; // Adjust the position of upright (vertical) glyphs. diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index eda090f..27394c7 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -618,7 +618,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) // See http://unicode.org/reports/tr50/#vo if (vcl::GetVerticalOrientation(aChar) != VerticalOrientation::TransformedRotated || IsVerticalAlternate(pHbGlyphInfos[i].codepoint)) -nGlyphIndex |= GF_ROTL; +
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/sallayout.hxx| 16 +-- vcl/quartz/salgdi.cxx|8 - vcl/source/gdi/pdfwriter_impl.cxx| 58 ++--- vcl/source/gdi/pdfwriter_impl.hxx|2 vcl/source/gdi/sallayout.cxx | 129 --- vcl/source/outdev/font.cxx | 12 +- vcl/source/outdev/text.cxx | 24 ++--- vcl/source/outdev/textline.cxx | 11 -- vcl/unx/generic/gdi/cairotextrender.cxx |9 +- vcl/unx/generic/print/genpspgraphics.cxx | 30 +-- vcl/win/gdi/winlayout.cxx| 81 +++ 11 files changed, 151 insertions(+), 229 deletions(-) New commits: commit b894104a0b02a9b074c76feb925389d7bee6a493 Author: Khaled HosnyDate: Thu Dec 8 00:43:09 2016 +0200 Pass GlyphItem around We have this nice structure that contains (almost) all the information we need, so pass it around instead of passing separate fragments of said information. The ultimate is to kill the horrible sal_GlyphId hack if encoding various bits of information in the higher bits of a 32-bit integer. Change-Id: Ie496bb4c2932157527a388e2a94e46bf0a325a70 Reviewed-on: https://gerrit.libreoffice.org/31781 Tested-by: Jenkins Reviewed-by: Khaled Hosny diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 3df4921..21a1e0b 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -39,6 +39,7 @@ typedef unsigned short LanguageType; class SalGraphics; class PhysicalFontFace; +struct GlyphItem; enum class SalLayoutFlags; namespace vcl { class TextLayoutCache; @@ -176,9 +177,8 @@ public: virtual boolIsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594 // methods using glyph indexing -virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdAry, Point& rPos, int&, - DeviceCoordinate* pGlyphAdvAry = nullptr, int* pCharPosAry = nullptr, - const PhysicalFontFace** pFallbackFonts = nullptr ) const = 0; +virtual int GetNextGlyphs(int nLen, const GlyphItem** pGlyphs, Point& rPos, int&, + const PhysicalFontFace** pFallbackFonts = nullptr) const = 0; virtual boolGetOutline( SalGraphics&, basegfx::B2DPolyPolygonVector& ) const; virtual boolGetBoundRect( SalGraphics&, Rectangle& ) const; @@ -234,9 +234,8 @@ public: virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const override; virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) const override; -virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos, - int&, DeviceCoordinate* pGlyphAdvAry = nullptr, int* pCharPosAry = nullptr, - const PhysicalFontFace** pFallbackFonts = nullptr ) const override; +virtual int GetNextGlyphs(int nLen, const GlyphItem** pGlyphs, Point& rPos, int&, + const PhysicalFontFace** pFallbackFonts = nullptr) const override; virtual boolGetOutline( SalGraphics&, basegfx::B2DPolyPolygonVector& ) const override; virtual boolIsKashidaPosValid(int nCharPos) const override; @@ -338,9 +337,8 @@ public: virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) const override; // used by display layers -virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos, int&, - DeviceCoordinate* pGlyphAdvAry = nullptr, int* pCharPosAry = nullptr, - const PhysicalFontFace** pFallbackFonts = nullptr ) const override; +virtual int GetNextGlyphs(int nLen, const GlyphItem** pGlyphs, Point& rPos, int&, + const PhysicalFontFace** pFallbackFonts = nullptr) const override; protected: GenericSalLayout(); diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index c2dba02..4b3a63a 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -415,12 +415,12 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) CGAffineTransform aRotMatrix = CGAffineTransformMakeRotation(-rStyle.mfFontRotation); Point aPos; -sal_GlyphId aGlyphId; +const GlyphItem* pGlyph; std::vector aGlyphIds; std::vector aGlyphPos; std::vector aGlyphOrientation; int nStart = 0; -while (rLayout.GetNextGlyphs(1, , aPos, nStart)) +while (rLayout.GetNextGlyphs(1, , aPos, nStart)) { CGPoint aGCPos = CGPointMake(aPos.X(), -aPos.Y()); @@ -429,7 +429,7 @@ void
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/osx/salinst.h |4 ++-- vcl/quartz/ctlayout.cxx |6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 0bab74d6357c6438cfb38d56dd8f75217af6bd2a Author: Stephan BergmannDate: Mon Aug 8 11:46:36 2016 +0200 loplugin:overrideparam Change-Id: I34fc490407f2bdac036dced5360b438ffb1cb4e2 diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h index 2047ec5..805ce3a 100644 --- a/vcl/inc/osx/salinst.h +++ b/vcl/inc/osx/salinst.h @@ -85,12 +85,12 @@ public: virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override; virtual voidDestroyFrame( SalFrame* pFrame ) override; virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, - bool bShow = true ) override; + bool bShow ) override; virtual voidDestroyObject( SalObject* pObject ) override; virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, long , long , DeviceFormat eFormat, - const SystemGraphicsData *pData ) override; + const SystemGraphicsData *pData = nullptr ) override; virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pSetupData ) override; virtual voidDestroyInfoPrinter( SalInfoPrinter* pPrinter ) override; diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index 0c46c95..d4eed46 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -42,12 +42,12 @@ public: virtual boolDrawTextSpecial( SalGraphics& rGraphics, sal_uInt32 flags ) const override; virtual int GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, int&, - DeviceCoordinate* pGlyphAdvances, int* pCharIndexes, - const PhysicalFontFace** pFallbackFonts ) const override; + DeviceCoordinate* pGlyphAdvances = nullptr, int* pCharIndexes = nullptr, + const PhysicalFontFace** pFallbackFonts = nullptr ) const override; virtual DeviceCoordinate GetTextWidth() const override; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const override; -virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override; +virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra = 0, int nFactor = 1) const override; virtual voidGetCaretPositions( int nArraySize, long* pCaretXArray ) const override; virtual boolGetBoundRect( SalGraphics&, Rectangle& ) const override; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/pch/precompiled_vcl.hxx |1 vcl/inc/quartz/salbmp.h |6 ++-- vcl/quartz/salbmp.cxx | 49 3 files changed, 28 insertions(+), 28 deletions(-) New commits: commit 0edec345cdbceae4847d1780f914ce16e56c0959 Author: Michael StahlDate: Wed May 25 23:10:03 2016 +0200 vcl: replace boost::shared_array with std::shared_ptr This was already using get() everywhere. Change-Id: I6d1eee4fe9b0494a1c49ac44917d9fc7c22b43a4 Reviewed-on: https://gerrit.libreoffice.org/25470 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index 833d73e..06dc155 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h index 6ffd1e3..994604f 100644 --- a/vcl/inc/quartz/salbmp.h +++ b/vcl/inc/quartz/salbmp.h @@ -30,7 +30,7 @@ #include "salvd.hxx" #include "salbmp.hxx" -#include +#include struct BitmapBuffer; @@ -42,8 +42,8 @@ public: CGContextRefmxGraphicContext; mutable CGImageRef mxCachedImage; BitmapPalette maPalette; -boost::shared_array maUserBuffer; -boost::shared_array maContextBuffer; +std::shared_ptr m_pUserBuffer; +std::shared_ptr m_pContextBuffer; sal_uInt16 mnBits; int mnWidth; int mnHeight; diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index 3464307..4ec0809 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -176,7 +177,7 @@ bool QuartzSalBitmap::Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount { const QuartzSalBitmap& rSourceBitmap = static_cast(rSalBmp); -if( isValidBitCount( nNewBitCount ) && rSourceBitmap.maUserBuffer.get() ) +if (isValidBitCount(nNewBitCount) && rSourceBitmap.m_pUserBuffer.get()) { mnBits = nNewBitCount; mnWidth = rSourceBitmap.mnWidth; @@ -186,9 +187,9 @@ bool QuartzSalBitmap::Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount if( AllocateUserData() ) { ConvertBitmapData( mnWidth, mnHeight, mnBits, mnBytesPerRow, maPalette, - maUserBuffer.get(), rSourceBitmap.mnBits, + m_pUserBuffer.get(), rSourceBitmap.mnBits, rSourceBitmap.mnBytesPerRow, rSourceBitmap.maPalette, - rSourceBitmap.maUserBuffer.get() ); + rSourceBitmap.m_pUserBuffer.get() ); return true; } } @@ -204,7 +205,7 @@ bool QuartzSalBitmap::Create( const css::uno::Reference< css::rendering::XBitmap void QuartzSalBitmap::Destroy() { DestroyContext(); -maUserBuffer.reset(); +m_pUserBuffer.reset(); } void QuartzSalBitmap::DestroyContext() @@ -221,7 +222,7 @@ void QuartzSalBitmap::DestroyContext() SAL_INFO("vcl.cg", "CGContextRelease(" << mxGraphicContext << ")" ); CGContextRelease( mxGraphicContext ); mxGraphicContext = nullptr; -maContextBuffer.reset(); +m_pContextBuffer.reset(); } } @@ -231,7 +232,7 @@ bool QuartzSalBitmap::CreateContext() // prepare graphics context // convert image from user input if available -const bool bSkipConversion = !maUserBuffer; +const bool bSkipConversion = !m_pUserBuffer; if( bSkipConversion ) AllocateUserData(); @@ -245,12 +246,12 @@ bool QuartzSalBitmap::CreateContext() if( (mnBits == 16) || (mnBits == 32) ) { // no conversion needed for truecolor -maContextBuffer = maUserBuffer; +m_pContextBuffer = m_pUserBuffer; } else if( mnBits == 8 && maPalette.IsGreyPalette() ) { // no conversion needed for grayscale -maContextBuffer = maUserBuffer; +m_pContextBuffer = m_pUserBuffer; aCGColorSpace = GetSalData()->mxGraySpace; aCGBmpInfo = kCGImageAlphaNone; bitsPerComponent = mnBits; @@ -262,17 +263,17 @@ bool QuartzSalBitmap::CreateContext() nContextBytesPerRow = mnWidth << 2; try { -maContextBuffer.reset( new sal_uInt8[ mnHeight * nContextBytesPerRow ] ); +m_pContextBuffer = o3tl::make_shared_array(mnHeight * nContextBytesPerRow); #ifdef DBG_UTIL for (size_t i = 0; i < mnHeight * nContextBytesPerRow; i++) -maContextBuffer.get()[i] = (i & 0xFF); +m_pContextBuffer.get()[i] = (i & 0xFF); #endif if( !bSkipConversion )
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win
vcl/inc/fontattributes.hxx |2 +- vcl/inc/impfont.hxx|2 -- vcl/quartz/ctfonts.cxx |6 +++--- vcl/quartz/salgdi.cxx |2 +- vcl/source/font/PhysicalFontCollection.cxx |6 +++--- vcl/source/font/PhysicalFontFace.cxx | 12 ++-- vcl/source/font/PhysicalFontFamily.cxx |6 +++--- vcl/source/font/fontcache.cxx |2 +- vcl/source/font/fontselect.cxx |2 +- vcl/source/gdi/embeddedfontshelper.cxx |4 ++-- vcl/source/gdi/pdfwriter_impl.cxx | 18 +- vcl/source/outdev/font.cxx |4 ++-- vcl/unx/generic/fontmanager/fontconfig.cxx |2 +- vcl/unx/generic/fontmanager/fontsubst.cxx | 10 +- vcl/unx/generic/gdi/cairotextrender.cxx|2 +- vcl/unx/generic/glyphs/freetype_glyphcache.cxx |2 +- vcl/unx/generic/glyphs/glyphcache.cxx |4 ++-- vcl/unx/generic/print/genpspgraphics.cxx |2 +- vcl/win/gdi/salfont.cxx|6 +++--- 19 files changed, 46 insertions(+), 48 deletions(-) New commits: commit 2a3caade0d3e0a1c47b57658230c6efb7e9a96f1 Author: Chris SherlockDate: Sun Jan 17 01:00:00 2016 +1100 vcl: FontAttributes::GetSlantType() -> FontAttributes::GetItalic() This brings FontAttributes into line with ImplFont and Font, which is important to the refactoring work I am doing. Change-Id: I08160992834f3732738b40aae9264df00443795a Reviewed-on: https://gerrit.libreoffice.org/21576 Tested-by: Jenkins Reviewed-by: Chris Sherlock diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx index 17eddc6..cd53400 100644 --- a/vcl/inc/fontattributes.hxx +++ b/vcl/inc/fontattributes.hxx @@ -35,7 +35,7 @@ public: const OUString& GetStyleName() const{ return maStyleName; } FontWeight GetWeight() const { return meWeight; } -FontItalic GetSlantType() const{ return meItalic; } +FontItalic GetItalic() const { return meItalic; } FontPitch GetPitch() const{ return mePitch; } FontWidth GetWidthType() const{ return meWidthType; } rtl_TextEncoding GetCharSet() const { return meCharSet; } diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 54b4cf8..f9c006f 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -45,8 +45,6 @@ public: FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; } FontWeight GetWeightNoAsk() const { return meWeight; } -FontItalic GetSlantType() { return GetItalic(); } -FontItalic GetSlantType() const{ return GetItalicNoAsk(); } FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; } FontItalic GetItalicNoAsk() const { return meItalic; } FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW)AskConfig(); return mePitch; } diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 573f8ef..724f8c7 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -87,9 +87,9 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD ) } // fake italic -if (((pReqFont->GetSlantType() == ITALIC_NORMAL) || - (pReqFont->GetSlantType() == ITALIC_OBLIQUE)) && -(mpFontData->GetSlantType() == ITALIC_NONE)) +if (((pReqFont->GetItalic() == ITALIC_NORMAL) || + (pReqFont->GetItalic() == ITALIC_OBLIQUE)) && +(mpFontData->GetItalic() == ITALIC_NONE)) { aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, toRadian(120), 1, 0, 0)); } diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index d911d80..f35e895 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -442,7 +442,7 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac << " for "<< pReqFont->GetFamilyName() << ", " << pReqFont->GetStyleName() << " weight=" << pReqFont->GetWeight() -<< " slant=" << pReqFont->GetSlantType() +<< " slant=" << pReqFont->GetItalic() << " size=" << pReqFont->mnHeight << "x" << pReqFont->mnWidth << " orientation=" << pReqFont->mnOrientation ); diff --git
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h | 18 +- vcl/quartz/ctfonts.cxx | 18 +- vcl/quartz/ctlayout.cxx |2 +- vcl/quartz/salgdi.cxx | 34 +- 4 files changed, 36 insertions(+), 36 deletions(-) New commits: commit 416d7ccb4e0c56199034b7fb01aefc988d7783a0 Author: Chris SherlockDate: Sun Jan 10 10:16:02 2016 +1100 vcl: (OS X only) Change CoreTextFontData to CoreTextFontFace The base class is called PhysicalFontFace (I believe it was called something like ImplFontData or somesuch before it was changed), and it is really primarily used to provide a factory function to create the logical font instance that LibreOffice can use (i.e. we distinguish between "physical" and "logical" fonts - as physical font is the actual font installed on the system, and the logical font is the one we ask for and have mapped to the physical font face). I also want to provide naming consistency in the class heirachy to enhance code readability, so that's another reason I've changed this class name. Change-Id: Ib7f23da1e3a1db59f4d04f5bb096f490e2958a4b Reviewed-on: https://gerrit.libreoffice.org/21299 Tested-by: Jenkins Reviewed-by: Chris Sherlock diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 836eee2..5bfbed2 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -54,11 +54,11 @@ typedef sal_uInt32 sal_GlyphId; typedef std::vector ByteVector; // CoreText-specific physically available font face -class CoreTextFontData : public PhysicalFontFace +class CoreTextFontFace : public PhysicalFontFace { public: -CoreTextFontData( const ImplFontAttributes&, sal_IntPtr nFontID ); -virtual ~CoreTextFontData(); +CoreTextFontFace( const ImplFontAttributes&, sal_IntPtr nFontID ); +virtual ~CoreTextFontFace(); PhysicalFontFace* Clone() const override; LogicalFontInstance*CreateFontInstance( FontSelectPattern& ) const override; @@ -74,7 +74,7 @@ public: voidReadMacCmapEncoding() const; protected: -CoreTextFontData( const CoreTextFontData& ); +CoreTextFontFace( const CoreTextFontFace& ); private: const sal_IntPtrmnFontId; @@ -98,7 +98,7 @@ public: bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const; bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const; -const CoreTextFontData* mpFontData; +const CoreTextFontFace* mpFontData; /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0 float mfFontStretch; /// text rotation in radian @@ -122,16 +122,16 @@ public: ~SystemFontList( void ); boolInit( void ); -voidAddFont( CoreTextFontData* ); +voidAddFont( CoreTextFontFace* ); voidAnnounceFonts( PhysicalFontCollection& ) const; -CoreTextFontData* GetFontDataFromId( sal_IntPtr nFontId ) const; +CoreTextFontFace* GetFontDataFromId( sal_IntPtr nFontId ) const; private: CTFontCollectionRef mpCTFontCollection; CFArrayRef mpCTFontArray; -typedef std::unordered_map CTFontContainer; +typedef std::unordered_map CTFontContainer; CTFontContainer maFontContainer; }; @@ -166,7 +166,7 @@ protected: RGBAColor maFillColor; // Device Font settings -const CoreTextFontData* mpFontData; +const CoreTextFontFace* mpFontData; CoreTextStyle* mpTextStyle; RGBAColor maTextColor; /// allows text to be rendered without antialiasing diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 4d847ba..e33ce7e 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -45,7 +45,7 @@ inline double toRadian(int nDegree) } CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD ) -: mpFontData( static_cast(rFSD.mpFontData) ) +: mpFontData( static_cast(rFSD.mpFontData) ) , mfFontStretch( 1.0 ) , mfFontRotation( 0.0 ) , mpStyleDict( nullptr ) @@ -235,19 +235,19 @@ bool CoreTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolyg return true; } -PhysicalFontFace* CoreTextFontData::Clone() const +PhysicalFontFace* CoreTextFontFace::Clone() const { -return new CoreTextFontData( *this); +return new CoreTextFontFace( *this); } -LogicalFontInstance* CoreTextFontData::CreateFontInstance( /*const*/ FontSelectPattern& rFSD ) const +LogicalFontInstance*
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source
vcl/inc/sft.hxx|8 vcl/quartz/ctfonts.cxx |2 +- vcl/quartz/ctlayout.cxx|4 ++-- vcl/quartz/utils.cxx | 11 ++- vcl/source/fontsubset/sft.cxx |4 ++-- vcl/source/fontsubset/xlat.cxx | 10 +- vcl/source/window/syschild.cxx |3 ++- 7 files changed, 22 insertions(+), 20 deletions(-) New commits: commit a3db321ecb1cf9f8c08476ecc699931b6111bc21 Author: Stephan BergmannDate: Tue Nov 17 10:43:03 2015 +0100 Don't assume sal_Unicode is unsigned short Change-Id: I7a741130689721c69fd2879be6bda27fc6ec3646 diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 220518c..ec8c6a0 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -180,9 +180,9 @@ namespace vcl typedef struct { char *family; /**< family name */ -sal_uInt16 *ufamily; /**< family name UCS2 */ +sal_Unicode *ufamily; /**< family name UCS2 */ char *subfamily; /**< subfamily name */ -sal_uInt16 *usubfamily; /**< subfamily name UCS2 */ +sal_Unicode *usubfamily; /**< subfamily name UCS2 */ char *psname; /**< PostScript name */ sal_uInt16 macStyle; /**< macstyle bits from 'HEAD' table */ int weight; /**< value of WeightClass or 0 if can't be determined*/ @@ -527,9 +527,9 @@ namespace vcl char*psname; char*family; -sal_uInt16 *ufamily; +sal_Unicode *ufamily; char*subfamily; -sal_uInt16 *usubfamily; +sal_Unicode *usubfamily; sal_uInt32 ntables; sal_uInt32 *goffsets; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 8f352b8..2042618 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -296,7 +296,7 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool #ifdef MACOSX const OUString aUILang = Application::GetSettings().GetUILanguageTag().getLanguage(); CFStringRef pUILang = CFStringCreateWithCharacters( kCFAllocatorDefault, -aUILang.getStr(), aUILang.getLength() ); + reinterpret_cast(aUILang.getStr()), aUILang.getLength() ); CFStringRef pLang = nullptr; CFStringRef pFamilyName = static_cast( CTFontDescriptorCopyLocalizedAttribute( pFD, kCTFontFamilyNameAttribute, )); diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index 61ddecc..0eff2a0 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -135,7 +135,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs& rArgs ) // create the CoreText line layout CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( nullptr, - pStr + mnMinCharPos, + reinterpret_cast(pStr + mnMinCharPos), mnCharCount, kCFAllocatorNull ); // CFAttributedStringCreate copies the attribues parameter @@ -213,7 +213,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) CFRelease( mpCTLine ); const sal_Unicode *pStr = rArgs.mrStr.getStr(); CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( nullptr, - pStr + mnMinCharPos, + reinterpret_cast(pStr + mnMinCharPos), mnCharCount - mnTrailingSpaceCount, kCFAllocatorNull ); CFAttributedStringRef pAttrStr = CFAttributedStringCreate( nullptr, diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx index 7194ad3..f0ebb9a 100644 --- a/vcl/quartz/utils.cxx +++ b/vcl/quartz/utils.cxx @@ -43,14 +43,14 @@ OUString GetOUString( CFStringRef rStr ) const UniChar* pConstStr = CFStringGetCharactersPtr( rStr ); if( pConstStr ) { -return OUString( pConstStr, nLength ); +return OUString( reinterpret_cast(pConstStr), nLength ); } UniChar* pStr = static_cast ( rtl_allocateMemory( sizeof(UniChar)*nLength ) ); CFRange aRange = { 0, nLength }; CFStringGetCharacters( rStr, aRange, pStr ); -OUString aRet( pStr, nLength ); +OUString aRet( reinterpret_cast(pStr), nLength ); rtl_freeMemory( pStr ); return aRet; } @@ -70,19 +70,20 @@ OUString
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |4 vcl/inc/quartz/utils.h |2 vcl/quartz/CTRunData.cxx|5 vcl/quartz/ctfonts.cxx | 150 - vcl/quartz/ctlayout.cxx | 18 + vcl/quartz/salbmp.cxx | 296 +++--- vcl/quartz/salgdi.cxx | 275 ++-- vcl/quartz/salgdicommon.cxx | 488 vcl/quartz/salgdiutils.cxx | 74 +++--- vcl/quartz/salvd.cxx| 88 +-- vcl/quartz/utils.cxx| 33 ++ 11 files changed, 856 insertions(+), 577 deletions(-) New commits: commit b20becf9e3934914b3291ca73962fbaddf616b74 Author: Norbert Thiebaud nthieb...@gmail.com Date: Tue Aug 11 20:19:37 2015 -0500 cosmetic: clean-up vcl/quartz Change-Id: I6f15e7ce90598eb4f8e7bb59c7c65d1aa333b972 Reviewed-on: https://gerrit.libreoffice.org/17661 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Norbert Thiebaud nthieb...@gmail.com diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 557d1496..72cd424 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -141,11 +141,11 @@ class AquaSalGraphics : public SalGraphics { friend class CTLayout; protected: +CGLayerRef mxLayer;// Quartz graphics layer +CGContextRefmrContext; // Quartz drawing context #ifdef MACOSX AquaSalFrame* mpFrame; #endif -CGLayerRef mxLayer;// Quartz graphics layer -CGContextRefmrContext; // Quartz drawing context int mnContextStackDepth; XorEmulation* mpXorEmulation; int mnXorMode; // 0: off 1: on 2: invert only diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h index e408250..57a0402 100644 --- a/vcl/inc/quartz/utils.h +++ b/vcl/inc/quartz/utils.h @@ -45,8 +45,6 @@ std::ostream operator (std::ostream s, const CGSize rSize); std::ostream operator (std::ostream s, CGColorRef pSize); std::ostream operator (std::ostream s, const CGAffineTransform aXform); -#define CG_TRACE( e ) SAL_INFO( vcl.cg, e ) - #endif // INCLUDED_VCL_INC_QUARTZ_UTILS_H /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/CTRunData.cxx b/vcl/quartz/CTRunData.cxx index 7ef3891..8f58d47 100644 --- a/vcl/quartz/CTRunData.cxx +++ b/vcl/quartz/CTRunData.cxx @@ -7,11 +7,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include sal/config.h #include sal/types.h + #include cassert -#include quartz/utils.h #include CTRunData.hxx +#include quartz/utils.h + CTRunData::CTRunData( CTRunRef pRun, int start) : ownership_flags(0) diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 274da6b..321f371 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -17,27 +17,26 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include impfont.hxx -#include outfont.hxx -#include PhysicalFontCollection.hxx -#include sallayout.hxx +#include sal/config.h + +#include basegfx/polygon/b2dpolygon.hxx +#include basegfx/matrix/b2dhommatrix.hxx + +#include vcl/settings.hxx + +#include ctfonts.hxx +#include impfont.hxx #ifdef MACOSX -#include osx/salinst.h #include osx/saldata.hxx -// kCTForegroundColorFromContextAttributeName is available on 10.5, but it is hidden -#ifndef kCTForegroundColorFromContextAttributeName -extern const CFStringRef kCTForegroundColorFromContextAttributeName; -#endif +#include osx/salinst.h #endif +#include outfont.hxx +#include PhysicalFontCollection.hxx #include quartz/salgdi.h #include quartz/utils.h -#include ctfonts.hxx - -#include vcl/settings.hxx +#include sallayout.hxx -#include basegfx/polygon/b2dpolygon.hxx -#include basegfx/matrix/b2dhommatrix.hxx inline double toRadian(int nDegree) { @@ -45,10 +44,10 @@ inline double toRadian(int nDegree) } CoreTextStyle::CoreTextStyle( const FontSelectPattern rFSD ) -: mpFontData( static_castCoreTextFontData const *(rFSD.mpFontData) ) -, mfFontStretch( 1.0 ) -, mfFontRotation( 0.0 ) -, mpStyleDict( NULL ) +: mpFontData( static_castCoreTextFontData const *(rFSD.mpFontData) ) +, mfFontStretch( 1.0 ) +, mfFontRotation( 0.0 ) +, mpStyleDict( NULL ) { const FontSelectPattern* const pReqFont = rFSD; @@ -70,7 +69,8 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern rFSD ) // create the style object for CoreText font attributes static const CFIndex nMaxDictSize = 16; // TODO: does this really suffice? mpStyleDict = CFDictionaryCreateMutable( NULL, nMaxDictSize, -kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks ); + kCFTypeDictionaryKeyCallBacks, +
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salbmp.h |2 +- vcl/quartz/salbmp.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 918a03c53839ad5696d0e154fbf657af49f67d8f Author: Noel Grandin n...@peralex.com Date: Wed May 6 09:14:12 2015 +0200 fix OSX build Change-Id: I6df0009cad65134e626f89563be168ff739ca092 diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h index 9c2209d..49679f0 100644 --- a/vcl/inc/quartz/salbmp.h +++ b/vcl/inc/quartz/salbmp.h @@ -77,7 +77,7 @@ public: boolCrop( const Rectangle rRectPixel ) SAL_OVERRIDE; boolErase( const Color rFillColor ) SAL_OVERRIDE; -boolScale( const double rScaleX, const double rScaleY, sal_uInt32 nScaleFlag ) SAL_OVERRIDE; +boolScale( const double rScaleX, const double rScaleY, BmpScaleFlag nScaleFlag ) SAL_OVERRIDE; boolReplace( const Color rSearchColor, const Color rReplaceColor, sal_uLong nTol ) SAL_OVERRIDE; private: diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index 2bb7b29..06b55ac 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -978,7 +978,7 @@ bool QuartzSalBitmap::Erase( const ::Color /*rFillColor*/ ) return false; } -bool QuartzSalBitmap::Scale( const double /*rScaleX*/, const double /*rScaleY*/, sal_uInt32 /*nScaleFlag*/ ) +bool QuartzSalBitmap::Scale( const double /*rScaleX*/, const double /*rScaleY*/, BmpScaleFlag /*nScaleFlag*/ ) { return false; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salvd.h |3 +++ vcl/quartz/salvd.cxx | 12 2 files changed, 15 insertions(+) New commits: commit 3cc833098a090b5ff611051e9da2af94d53d1017 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Nov 30 18:48:33 2014 +0100 implement virtual methods for OSX vcl backend Change-Id: Ifd7e06529cbf2e20bdd1560586420cda39c5a50c diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h index e1d1d51..e3c68ab 100644 --- a/vcl/inc/quartz/salvd.h +++ b/vcl/inc/quartz/salvd.h @@ -61,6 +61,9 @@ public: virtual SalGraphics*AcquireGraphics() SAL_OVERRIDE; virtual voidReleaseGraphics( SalGraphics* pGraphics ) SAL_OVERRIDE; virtual boolSetSize( long nNewDX, long nNewDY ) SAL_OVERRIDE; + +virtual long GetWidth() const SAL_OVERRIDE; +virtual long GetHeight() const SAL_OVERRIDE; }; #endif // INCLUDED_VCL_INC_QUARTZ_SALVD_H diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index a524c1e..ceb7e9b 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -277,4 +277,16 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) return (mxLayer != NULL); } +long AquaSalVirtualDevice::GetWidth() const +{ +const CGSize aSize = CGLayerGetSize( mxLayer ); +return aSize.width; +} + +long AquaSalVirtualDevice::GetHeight() const +{ +const CGSize aSize = CGLayerGetSize( mxLayer ); +return aSize.height; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source
vcl/inc/quartz/salgdi.h|2 +- vcl/quartz/ctfonts.cxx | 14 -- vcl/quartz/ctlayout.cxx|9 - vcl/source/outdev/text.cxx |8 4 files changed, 13 insertions(+), 20 deletions(-) New commits: commit 507efabe8b40e34c2bebfdaa00d4264c5345d3dd Author: Herbert Dürr h...@apache.org Date: Mon May 19 12:05:27 2014 + Resolves: #i124922# allow late setting of the font color... for CoreText-layouted text (cherry picked from commit 42f9768f771457c53a9f1e6a3581b2df9856401f) Conflicts: vcl/aqua/source/gdi/ctfonts.cxx vcl/aqua/source/gdi/ctfonts.hxx vcl/aqua/source/gdi/ctlayout.cxx vcl/source/gdi/outdev3.cxx Change-Id: Ie2685ab80ca87ea72e25f18d02f883fb36c24a36 diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 7451321..57dec5b 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -106,7 +106,7 @@ public: bool GetGlyphBoundRect( sal_GlyphId, Rectangle ) const; bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon ) const; -void SetTextColor( const RGBAColor ); +void SetTextColor( const RGBAColor ) {} const CoreTextFontData* mpFontData; /// 1.0: font is squeezed, 1.0 font is stretched, else 1.0 diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index bede546..d2e3d32 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -100,6 +100,10 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern rFSD ) CFDictionarySetValue( mpStyleDict, kCTFontAttributeName, pNewCTFont ); CFRelease( pNewCTFont); +// allow delayed setting the font color, i.e. after the text layout +CFDictionarySetValue( mpStyleDict, kCTForegroundColorFromContextAttributeName, kCFBooleanTrue ); + + #if 0 // LastResort is implicit in CoreText's font cascading const void* aGFBDescriptors[] = { CTFontDescriptorCreateWithNameAndSize( CFSTR(LastResort), 0) }; // TODO: use the full GFB list const int nGfbCount = sizeof(aGFBDescriptors) / sizeof(*aGFBDescriptors); @@ -218,16 +222,6 @@ bool CoreTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolyg return true; } -void CoreTextStyle::SetTextColor( const RGBAColor rColor ) -{ -CGFloat aColor[] = { rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue(), rColor.GetAlpha() }; -CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); -CGColorRef pCGColor = CGColorCreate( cs, aColor ); -CGColorSpaceRelease( cs ); -CFDictionarySetValue( mpStyleDict, kCTForegroundColorAttributeName, pCGColor ); -CFRelease( pCGColor); -} - PhysicalFontFace* CoreTextFontData::Clone( void ) const { return new CoreTextFontData( *this); diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index f74b235..347cc5e 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -108,6 +108,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs rArgs ) m_vRunData.release(); bLayouted = false; +// release an eventual older layout if( mpAttrString ) CFRelease( mpAttrString ); mpAttrString = NULL; @@ -115,6 +116,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs rArgs ) CFRelease( mpCTLine ); mpCTLine = NULL; +// initialize the new layout SalLayout::AdjustLayout( rArgs ); mnCharCount = mnEndCharPos - mnMinCharPos; @@ -338,7 +340,7 @@ void CTLayout::drawCTLine(AquaSalGraphics rAquaGraphics, CTLineRef ctline, cons CGContextScaleCTM( rAquaGraphics.mrContext, 1.0, -1.0 ); CGContextSetShouldAntialias( rAquaGraphics.mrContext, !rAquaGraphics.mbNonAntialiasedText ); -// Draw the text +// set the text transformation (e.g. position) CGPoint aTextPos = GetTextDrawPosition(); if( pStyle-mfFontRotation != 0.0 ) @@ -353,7 +355,12 @@ void CTLayout::drawCTLine(AquaSalGraphics rAquaGraphics, CTLineRef ctline, cons SAL_INFO( vcl.ct, CGContextSetTextPosition( rAquaGraphics.mrContext , aTextPos ) ); CGContextSetTextPosition( rAquaGraphics.mrContext, aTextPos.x, aTextPos.y ); + +// set the text color as fill color (see kCTForegroundColorFromContextAttributeName) +CGContextSetFillColor( rAquaGraphics.mrContext, rAquaGraphics.maTextColor.AsArray() ); + SAL_INFO( vcl.ct, CTLineDraw( ctline , rAquaGraphics.mrContext ) ); +// draw the text CTLineDraw( ctline, rAquaGraphics.mrContext ); #ifndef IOS // request an update of the changed window area diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index c5030ad..b7bb028 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1282,14 +1282,6 @@ SalLayout* OutputDevice::ImplLayout(const OUString rOrigStr, ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, nMinIndex, nLen, nPixelWidth, pDXArray ); -#if defined(MACOSX) || defined(IOS) -// CoreText layouts are immutable and already contain
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salbmp.h |4 -- vcl/quartz/salbmp.cxx | 94 ++-- 2 files changed, 5 insertions(+), 93 deletions(-) New commits: commit a475c6963e639bbc575d3591c804fbb1ef980183 Author: Tor Lillqvist t...@collabora.com Date: Thu Mar 20 18:14:14 2014 +0200 Bin some dead code Has been dead since bff2ddbbfb8a4cebee2cc223c3bba6a8d9ebc038, when we stopped using SvpSalVirtualDevice on iOS. Change-Id: I4403f61fac73596f1c7c3d11b2351c37173c970d diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h index 136e6d2..1e946d2 100644 --- a/vcl/inc/quartz/salbmp.h +++ b/vcl/inc/quartz/salbmp.h @@ -55,7 +55,6 @@ public: int mnWidth; int mnHeight; sal_uInt32 mnBytesPerRow; -void* maExternalData; public: QuartzSalBitmap(); @@ -71,8 +70,6 @@ public: virtual boolCreate( const ::com::sun::star::uno::Reference ::com::sun::star::rendering::XBitmapCanvas xBitmapCanvas, Size rSize, bool bMask = false ); -// creating quartz wrapper from existing buffer -boolCreate( BitmapBuffer buffer); voidDestroy(); @@ -96,7 +93,6 @@ private: public: boolCreate( CGLayerRef xLayer, int nBitCount, int nX, int nY, int nWidth, int nHeight ); -boolCreate( CGImageRef xImage, int nBitCount, int nX, int nY, int nWidth, int nHeight ); public: CGImageRef CreateWithMask( const QuartzSalBitmap rMask, int nX, int nY, int nWidth, int nHeight ) const; diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index fb3ca3c..3732550 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -62,7 +62,6 @@ QuartzSalBitmap::QuartzSalBitmap() , mnWidth(0) , mnHeight(0) , mnBytesPerRow(0) -, maExternalData(NULL) { } @@ -108,77 +107,6 @@ bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits, return true; } - - -bool QuartzSalBitmap::Create( CGImageRef xImage, int nBitmapBits, - int nX, int nY, int nWidth, int nHeight ) -{ -DBG_ASSERT( xImage, QuartzSalBitmap::Create() from null image ); - -// sanitize input parameters -if( nX 0 ) -nWidth += nX, nX = 0; -if( nY 0 ) -nHeight += nY, nY = 0; -const CGSize aLayerSize = CGSizeMake(CGImageGetWidth(xImage), CGImageGetHeight(xImage)); -if( nWidth = (int)aLayerSize.width - nX ) -nWidth = (int)aLayerSize.width - nX; -if( nHeight = (int)aLayerSize.height - nY ) -nHeight = (int)aLayerSize.height - nY; -if( (nWidth 0) || (nHeight 0) ) -nWidth = nHeight = 0; - -// initialize properties -mnWidth = nWidth; -mnHeight = nHeight; -mnBits = nBitmapBits ? nBitmapBits : 32; - -// initialize drawing context -CreateContext(); - -// copy layer content into the bitmap buffer -if(mxGraphicContext) // remove warning -{ -// Flip the image right side up draw -CGContextSaveGState(mxGraphicContext); - -CGContextScaleCTM(mxGraphicContext, 1.0, -1.0); -CGContextTranslateCTM(mxGraphicContext, 0.0, -aLayerSize.height); - -CGContextDrawImage( mxGraphicContext, - CGRectMake(static_castCGFloat(-nX), - static_castCGFloat(nY), - aLayerSize.width, - aLayerSize.height), - xImage ); - -// Restore the context so that the coordinate system is restored -CGContextRestoreGState(mxGraphicContext); - -} - - -return true; -} - -bool QuartzSalBitmap::Create( BitmapBuffer buffer) -{ -// initialize properties -mnWidth = buffer.mnWidth; -mnHeight = buffer.mnHeight; -mnBits = buffer.mnBitCount; -mnBytesPerRow = buffer.mnScanlineSize; -maExternalData = buffer.mpBits; -maPalette = buffer.maPalette; - -// initialize drawing context -CreateContext(); - -return true; -} - - - bool QuartzSalBitmap::Create( const Size rSize, sal_uInt16 nBits, const BitmapPalette rBitmapPalette ) { if( !isValidBitCount( nBits ) ) @@ -239,7 +167,6 @@ void QuartzSalBitmap::Destroy() { DestroyContext(); maUserBuffer.reset(); -maExternalData = NULL; } @@ -265,7 +192,7 @@ bool QuartzSalBitmap::CreateContext() // prepare graphics context // convert image from user input if available -const bool bSkipConversion = !maUserBuffer !maExternalData; +const bool bSkipConversion = !maUserBuffer; if( bSkipConversion ) AllocateUserData(); @@ -282,11 +209,8 @@ bool QuartzSalBitmap::CreateContext() sal_uInt32 nContextBytesPerRow = mnBytesPerRow; if( (mnBits == 16) || (mnBits == 32) ) { -if (!maExternalData) -
[Libreoffice-commits] core.git: vcl/inc vcl/quartz
vcl/inc/quartz/salgdi.h |9 + vcl/quartz/ctfonts.cxx |8 +++- vcl/quartz/salgdi.cxx | 24 3 files changed, 36 insertions(+), 5 deletions(-) New commits: commit ae4a8c6152a6234eed52482da64d84ad5a56c03d Author: Douglas Mencken dougmenc...@gmail.com Date: Sat Feb 22 14:24:45 2014 -0500 CoreText SDK 10.5 compatibility Change-Id: Ic876ec473b1c03a70c160af4251c68b299b27eca Reviewed-on: https://gerrit.libreoffice.org/7143 Reviewed-by: Norbert Thiebaud nthieb...@gmail.com Tested-by: Norbert Thiebaud nthieb...@gmail.com diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 7cd2e83..a6c8a8c 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -29,6 +29,15 @@ #include ApplicationServices/ApplicationServices.h #include osx/osxvcltypes.h #include osx/salframe.h + +#if MAC_OS_X_VERSION_MAX_ALLOWED 1060 +// The following symbols are SPI (System Programming Interface) in 10.5. +extern C { +void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]); +const CGSize* CTRunGetAdvancesPtr(CTRunRef run); +extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel; +} +#endif #else #include CoreGraphics/CoreGraphics.h #include CoreText/CoreText.h diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index ea89b53..72bc087 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -80,9 +80,13 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern rFSD ) ((mpFontData-GetWeight() WEIGHT_SEMIBOLD) (mpFontData-GetWeight() != WEIGHT_DONTKNOW)) ) { +#if MAC_OS_X_VERSION_MAX_ALLOWED = 1060 int nStroke = -10.0; CFNumberRef rStroke = CFNumberCreate(NULL, kCFNumberSInt32Type, nStroke); CFDictionarySetValue(mpStyleDict, kCTStrokeWidthAttributeName, rStroke); +#else /* kCTStrokeWidthAttributeName is not available */ +/* do we really need fake bold? */ +#endif } // fake italic @@ -335,9 +339,11 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool // get font-enabled status if( bFontEnabled ) { -int bEnabled = FALSE; +int bEnabled = TRUE; // by default (and when we're on OS X 10.6) it's enabled +#if MAC_OS_X_VERSION_MAX_ALLOWED = 1060 CFNumberRef pEnabled = (CFNumberRef)CTFontDescriptorCopyAttribute( pFD, kCTFontEnabledAttribute ); CFNumberGetValue( pEnabled, kCFNumberIntType, bEnabled ); +#endif *bFontEnabled = bEnabled; } diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index d826215..41e1b49 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -337,16 +337,32 @@ static bool AddTempDevFont(const OUString rFontFileURL) CFStringRef rFontPath = CFStringCreateWithCString(NULL, aCFileName.getStr(), kCFStringEncodingUTF8); CFURLRef rFontURL = CFURLCreateWithFileSystemPath(NULL, rFontPath, kCFURLPOSIXPathStyle, true); -CFErrorRef error; -bool success = CTFontManagerRegisterFontsForURL(rFontURL, kCTFontManagerScopeProcess, error); +bool success = false; +#if MAC_OS_X_VERSION_MAX_ALLOWED = 1060 +CFErrorRef error; +success = CTFontManagerRegisterFontsForURL(rFontURL, kCTFontManagerScopeProcess, error); if (!success) { CFRelease(error); -return false; } +#else /* CTFontManagerRegisterFontsForURL is not available on OS X 10.6 */ +CGDataProviderRef dataProvider = CGDataProviderCreateWithURL(rFontURL); +CGFontRef graphicsFont = CGFontCreateWithDataProvider(dataProvider); +if (graphicsFont) +{ +CTFontRef coreTextFont = CTFontCreateWithGraphicsFont(graphicsFont, /*fontSize*/ 0, /*matrix*/ NULL, /*attributes*/ NULL); +if (coreTextFont) +{ +success = true; +CFRelease(coreTextFont); +} +CGFontRelease(graphicsFont); +} +CGDataProviderRelease(dataProvider); +#endif -return true; +return success; } static void AddTempFontDir( const OUString rFontDirUrl ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/win
vcl/inc/win/salgdi.h |2 +- vcl/quartz/salgdicommon.cxx |4 ++-- vcl/win/source/gdi/salgdi.cxx |2 +- 3 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 802ca8cd36c4b08c629a956a4ed774e70e6c0060 Author: Herbert Dürr h...@apache.org Date: Tue Dec 17 15:01:25 2013 + Related: #i123840# normalize SalFrame resolution type to sal_Int32 (cherry picked from commit 8a7cfd2bded9a531a034222c71ba3eda9df7d436) Conflicts: vcl/aqua/source/gdi/salgdi.cxx vcl/aqua/source/gdi/salprn.cxx vcl/aqua/source/window/salframe.cxx vcl/inc/aqua/salframe.h vcl/inc/aqua/salgdi.h vcl/inc/os2/salgdi.h vcl/os2/source/gdi/salgdi.cxx vcl/unx/generic/gdi/salgdi3.cxx Change-Id: I86f2902d765422b4b850619c72119ad4e03452d7 diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index f29fd94..13a9a64 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -277,7 +277,7 @@ public: // public SalGraphics methods, the interface to the independent vcl part // get device resolution -virtual voidGetResolution( long rDPIX, long rDPIY ); +virtual voidGetResolution( sal_Int32 rDPIX, sal_Int32 rDPIY ); // get the depth of the device virtual sal_uInt16 GetBitCount() const; // get the width of the device diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index a204d74..75fea3f 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -1229,8 +1229,8 @@ void AquaSalGraphics::GetResolution( sal_Int32 rDPIX, sal_Int32 rDPIY ) initResolution( (mbWindow mpFrame) ? mpFrame-getNSWindow() : nil ); } -rDPIX = static_castsal_Int32(mfFakeDPIScale * mnRealDPIX); -rDPIY = static_castsal_Int32(mfFakeDPIScale * mnRealDPIY); +rDPIX = lrint( mfFakeDPIScale * mnRealDPIX); +rDPIY = lrint( mfFakeDPIScale * mnRealDPIY); } #endif diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index e3a660f..920648c 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -778,7 +778,7 @@ WinSalGraphics::~WinSalGraphics() // --- -void WinSalGraphics::GetResolution( long rDPIX, long rDPIY ) +void WinSalGraphics::GetResolution( sal_Int32 rDPIX, sal_Int32 rDPIY ) { rDPIX = GetDeviceCaps( getHDC(), LOGPIXELSX ); rDPIY = GetDeviceCaps( getHDC(), LOGPIXELSY ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits