[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx vcl/win

2022-11-19 Thread Khaled Hosny (via logerrit)
 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/source vcl/unx

2022-11-02 Thread Khaled Hosny (via logerrit)
 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/source vcl/unx vcl/win

2020-08-15 Thread Jan-Marek Glogowski (via logerrit)
 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/source vcl/unx vcl/win

2018-09-19 Thread Libreoffice Gerrit user
 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

2018-08-21 Thread Libreoffice Gerrit user
 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/source vcl/unx vcl/win

2018-05-29 Thread Stephan Bergmann
 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

2018-04-25 Thread Khaled Hosny
 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 Hosny 
Date:   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/source vcl/unx vcl/win

2017-02-09 Thread Noel Grandin
 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 Grandin 
Date:   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

2017-02-08 Thread Noel Grandin
 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 Grandin 
Date:   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/source vcl/unx vcl/win

2016-12-10 Thread Khaled Hosny
 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 Hosny 
Date:   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

2016-12-10 Thread Khaled Hosny
 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 Hosny 
Date:   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

2016-12-10 Thread Khaled Hosny
 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 Hosny 
Date:   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

2016-12-09 Thread Khaled Hosny
 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 Hosny 
Date:   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/source vcl/unx vcl/win

2016-01-18 Thread Chris Sherlock
 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 Sherlock 
Date:   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