[Libreoffice-commits] core.git: editeng/source

2022-08-14 Thread Khaled Hosny (via logerrit)
 editeng/source/editeng/impedit3.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 895843ad466954b63f6f99a1b6319b7813d0dbe1
Author: Khaled Hosny 
AuthorDate: Sat Aug 13 00:00:27 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 14 21:13:04 2022 +0200

tdf#103492: Messed Arabic letter spacing in text starting with LTR 
character(s)

This partially reverts the still relevant parts of commit

commit 41007842ed9bb5d6165792a197769f72dae55a2c
Author: Martin Hosken 
Date:   Thu Sep 10 10:14:18 2015 +0700

Refactor graphite integration and update graphite

Change-Id: I09db7262c2a6180a078620ba086dd7a4c132bd82
Reviewed-on: https://gerrit.libreoffice.org/18459
Tested-by: Jenkins 
Reviewed-by: László Németh 
Reviewed-by: Martin Hosken 

No mention of the commit about this change or its relevance to Graphite
integration. But the separate Graphite layout engine is long gone and
Graphite handling goes through HarfBuzz now, so whatever the change was
for is probably no longer relevant.

I reverted only one the two changes in impedit3.cxx, as the other one
does not seem to make any difference for this issue.

Change-Id: Id70a711d6231cce52c9a32dbc3604860b1da9f4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138217
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 6195b0e8e606..5ff196f02040 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -838,8 +838,6 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 EditLine aSaveLine( *pLine );
 SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() );
 
-ImplInitLayoutMode(*GetRefDevice(), nPara, nIndex);
-
 std::vector aBuf( pNode->Len() );
 
 bool bSameLineAgain = false;// For TextRanger, if the height changes.


[Libreoffice-commits] core.git: vcl/source

2022-08-14 Thread Khaled Hosny (via logerrit)
 vcl/source/gdi/CommonSalLayout.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 3836b99f335ac9e6890545607d07124e455eb531
Author: Khaled Hosny 
AuthorDate: Fri Aug 12 14:00:25 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 14 21:12:37 2022 +0200

Use doubles when calculating the number of Kashidas to insert

Makes it a bit more stable across zoom levels and avoids excessive
overlaps due to calculating one copy too many because of rounding
errors.

Change-Id: I6a21a89c1dfda085b1f7fa9570c9875a0d39f671
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138192
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 0bea121896b4..eff9dab9acbb 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -754,7 +754,7 @@ void GenericSalLayout::ApplyDXArray(const DC* pDXArray, 
const sal_Bool* pKashida
 return;
 
 // Find Kashida glyph width and index.
-DeviceCoordinate nKashidaWidth = 0;
+double nKashidaWidth = 0;
 hb_codepoint_t nKashidaIndex = 0;
 if (hb_font_get_glyph(GetFont().GetHbFont(), 0x0640, 0, ))
 nKashidaWidth = GetFont().GetKashidaWidth();
@@ -771,7 +771,7 @@ void GenericSalLayout::ApplyDXArray(const DC* pDXArray, 
const sal_Bool* pKashida
 auto pGlyphIter = m_GlyphItems.begin() + nInserted + pKashida.first;
 
 // The total Kashida width.
-DeviceCoordinate nTotalWidth = pKashida.second;
+double nTotalWidth = pKashida.second;
 
 // Number of times to repeat each Kashida.
 int nCopies = 1;
@@ -780,12 +780,12 @@ void GenericSalLayout::ApplyDXArray(const DC* pDXArray, 
const sal_Bool* pKashida
 
 // See if we can improve the fit by adding an extra Kashidas and
 // squeezing them together a bit.
-DeviceCoordinate nOverlap = 0;
-DeviceCoordinate nShortfall = nTotalWidth - nKashidaWidth * nCopies;
+double nOverlap = 0;
+double nShortfall = nTotalWidth - nKashidaWidth * nCopies;
 if (nShortfall > 0)
 {
 ++nCopies;
-DeviceCoordinate nExcess = nCopies * nKashidaWidth - nTotalWidth;
+double nExcess = nCopies * nKashidaWidth - nTotalWidth;
 if (nExcess > 0)
 nOverlap = nExcess / (nCopies - 1);
 }


[Libreoffice-commits] core.git: vcl/source

2022-08-14 Thread Khaled Hosny (via logerrit)
 vcl/source/font/fontinstance.cxx   |2 +-
 vcl/source/gdi/CommonSalLayout.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3d0e482df81a28e6d0eb86cda71ac49d3363ae50
Author: Khaled Hosny 
AuthorDate: Fri Aug 12 02:51:50 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 14 21:12:21 2022 +0200

tdf#106653: Try harder not to return 0 for Kashida width

The font in the bug document has a very small Kashida advance width and
this gets rounded to zero at smaller zoom level. Try to round up the
value to avoid returning zero too eagerly.

Change-Id: I78c309d66a9e94812827c7c6724c67c4d09bcff9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138169
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 0907d657ad02..44c2c8cc757d 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -73,7 +73,7 @@ int LogicalFontInstance::GetKashidaWidth() const
 {
 double nXScale = 0;
 GetScale(, nullptr);
-nWidth = hb_font_get_glyph_h_advance(pHbFont, nIndex) * nXScale;
+nWidth = std::ceil(hb_font_get_glyph_h_advance(pHbFont, nIndex) * 
nXScale);
 }
 
 return nWidth;
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index b3d63dac30a0..0bea121896b4 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -761,7 +761,7 @@ void GenericSalLayout::ApplyDXArray(const DC* pDXArray, 
const sal_Bool* pKashida
 
 if (nKashidaWidth <= 0)
 {
-SAL_WARN("vcl.gdi", "Asked to insert Kashidas in a font with 
zero-width Kashida");
+SAL_WARN("vcl.gdi", "Asked to insert Kashidas in a font with bogus 
Kashida width");
 return;
 }
 


[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source

2022-08-14 Thread Khaled Hosny (via logerrit)
 include/vcl/vcllayout.hxx  |2 
 vcl/inc/sallayout.hxx  |4 -
 vcl/source/gdi/CommonSalLayout.cxx |   82 +++--
 vcl/source/gdi/sallayout.cxx   |9 ++--
 vcl/source/outdev/font.cxx |   26 +--
 5 files changed, 54 insertions(+), 69 deletions(-)

New commits:
commit 5e2b7a656024b621bdeeb6efd977331191b66d9d
Author: Khaled Hosny 
AuthorDate: Fri Aug 12 02:12:04 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 14 21:11:52 2022 +0200

Streamline Kashida validation logic

We are asked to validate the position *after* which Kashida will be
inserted, but HarfBuzz will tell us which glyph we can insert Kashida
*before*. So align both by passing down the position before and after
and make the loop iterating over glyph items a lot simpler.

As a bonus, the new code allow Kashida insertion across layout change in
both sides, old code allowed it only at the start of the layout.

Change-Id: I9f632610b92c0f4c512e50456bf7d207175f17ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138168
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index 87d9345f4b9b..cbadb47ee0ba 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -92,7 +92,7 @@ public:
 virtual DeviceCoordinate FillDXArray( std::vector* 
pDXArray ) const = 0;
 virtual DeviceCoordinate GetTextWidth() const { return FillDXArray( 
nullptr ); }
 virtual voidGetCaretPositions( int nArraySize, sal_Int32* pCaretXArray 
) const = 0;
-virtual boolIsKashidaPosValid ( int /*nCharPos*/ ) const { return 
true; } // i60594
+virtual boolIsKashidaPosValid ( int /*nCharPos*/, int /*nNextCharPos*/ 
) const = 0; // i60594
 
 // methods using glyph indexing
 virtual boolGetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, 
int& nStart,
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 885de2446db7..b49c1c663ee4 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -68,7 +68,7 @@ public:
  const LogicalFontInstance** ppGlyphFont = 
nullptr,
  const vcl::font::PhysicalFontFace** 
pFallbackFont = nullptr) const override;
 boolGetOutline(basegfx::B2DPolyPolygonVector&) const override;
-boolIsKashidaPosValid(int nCharPos) const override;
+boolIsKashidaPosValid(int nCharPos, int nNextCharPos) const 
override;
 SalLayoutGlyphs GetGlyphs() const final override;
 
 // used only by OutputDevice::ImplLayout, TODO: make friend
@@ -115,7 +115,7 @@ public:
 voidDrawText(SalGraphics&) const final override;
 SalLayoutGlyphs GetGlyphs() const final override;
 
-boolIsKashidaPosValid(int nCharPos) const final override;
+boolIsKashidaPosValid(int nCharPos, int nNextCharPos) const 
final override;
 
 // used by upper layers
 DeviceCoordinate GetTextWidth() const final override;
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index da7334352858..b3d63dac30a0 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -719,22 +719,19 @@ void GenericSalLayout::ApplyDXArray(const DC* pDXArray, 
const sal_Bool* pKashida
 m_GlyphItems[i].addNewWidth(nDiff);
 m_GlyphItems[i].adjustLinearPosX(nDelta + nDiff);
 
-// Adjust the X position of the rest of the glyphs in the cluster.
 size_t j = i;
 while (j > 0)
 {
 --j;
-if (!m_GlyphItems[j].IsInCluster())
+if (!(m_GlyphItems[j].IsDiacritic() || 
m_GlyphItems[j].IsInCluster()))
 break;
-m_GlyphItems[j].adjustLinearPosX(nDelta + nDiff);
-}
 
-// Move any non-spacing marks to keep attached to this cluster.
-while (j > 0)
-{
-if (!m_GlyphItems[j].IsDiacritic())
-break;
-m_GlyphItems[j--].adjustLinearPosX(nDiff);
+if (m_GlyphItems[j].IsInCluster())
+// Adjust X position of the remainder of the cluster.
+m_GlyphItems[j].adjustLinearPosX(nDelta + nDiff);
+else
+// Move non-spacing marks to keep attached to this cluster.
+m_GlyphItems[j].adjustLinearPosX(nDiff);
 }
 
 // This is a Kashida insertion position, mark it. Kashida glyphs
@@ -807,56 +804,27 @@ void GenericSalLayout::ApplyDXArray(const DC* pDXArray, 
const sal_Bool* pKashida
 }
 }
 
-bool GenericSalLayout::IsKashidaPosValid(int nCharPos) const
+// Kashida will be inserted between nCharPos and nNextCharPos.
+bool GenericSalLayout::IsKashidaPosValid(int nCharPos, int 

[Libreoffice-commits] core.git: editeng/source sw/source

2022-08-14 Thread Khaled Hosny (via logerrit)
 editeng/source/editeng/impedit3.cxx |   18 ++
 sw/source/core/text/porlay.cxx  |   18 ++
 2 files changed, 20 insertions(+), 16 deletions(-)

New commits:
commit 72e56537d4bb9411229346da977d1d669ccfca9a
Author: Khaled Hosny 
AuthorDate: Thu Aug 11 18:52:17 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 14 21:11:15 2022 +0200

tdf#139627: Don’t set Kashida insertion position after combining marks

We were skipping the marks when checking for previous char, but not when
setting the index to previous char.

Fixes also the second part of tdf#106653.

Change-Id: I73436ba9df6ccf104ea6d4dfbd76a59c86040a44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138154
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index d712dfa5..6195b0e8e606 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2339,10 +2339,9 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, 
sal_Int32 nStart, sal_I
 // restore selection for proper iteration at the end of the function
 aWordSel.Max().SetIndex( nSavPos );
 
-sal_Int32 nIdx = 0;
+sal_Int32 nIdx = 0, nPrevIdx = 0;
 sal_Int32 nKashidaPos = -1;
-sal_Unicode cCh;
-sal_Unicode cPrevCh = 0;
+sal_Unicode cCh, cPrevCh = 0;
 
 int nPriorityLevel = 7;// 0..6 = level found
// 7 not found
@@ -2390,7 +2389,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, 
sal_Int32 nStart, sal_I
 // check if character is connectable to previous character,
 if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
 {
-nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
 nPriorityLevel = 2;
 }
 }
@@ -2411,7 +2410,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, 
sal_Int32 nStart, sal_I
 // check if character is connectable to previous character,
 if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
 {
-nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
 nPriorityLevel = 3;
 }
 }
@@ -2431,7 +2430,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, 
sal_Int32 nStart, sal_I
 // check if character is connectable to previous 
character,
 if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
 {
-nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
 nPriorityLevel = 4;
 }
 }
@@ -2453,7 +2452,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, 
sal_Int32 nStart, sal_I
 // check if character is connectable to previous character,
 if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
 {
-nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
 nPriorityLevel = 5;
 }
 }
@@ -2469,7 +2468,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, 
sal_Int32 nStart, sal_I
 // check if character is connectable to previous character,
 if ( lcl_ConnectToPrev( cCh, cPrevCh ) )
 {
-nKashidaPos = aWordSel.Min().GetIndex() + nIdx - 1;
+nKashidaPos = aWordSel.Min().GetIndex() + nPrevIdx;
 nPriorityLevel = 6;
 }
 }
@@ -2478,7 +2477,10 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, 
sal_Int32 nStart, sal_I
 // Do not consider vowel marks when checking if a character
 // can be connected to previous character.
 if ( !isTransparentChar ( cCh) )
+{
 cPrevCh = cCh;
+nPrevIdx = nIdx;
+}
 
 ++nIdx;
 } // end of current word
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 3db6a07600e9..d1e4b967f235 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1509,10 +1509,9 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& 
rNode,
 {
 const OUString& rWord = aScanner.GetWord();
 
-sal_Int32 nIdx = 0;
+ 

[Libreoffice-commits] core.git: editeng/source

2022-08-14 Thread Khaled Hosny (via logerrit)
 editeng/source/editeng/impedit3.cxx |  248 
 1 file changed, 199 insertions(+), 49 deletions(-)

New commits:
commit 640a2bc1cd093875b701bb958b6156d5752c0fac
Author: Khaled Hosny 
AuthorDate: Thu Aug 11 14:53:19 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 14 21:10:43 2022 +0200

tdf#137528: Sync Kashida algorithm in editeng with sw

It seems that editeng is using an old copy of the code in sw and it was
never updated.

With this change, the text in the test document from tdf#137528 looks
essentially identical in both cases.

Fixes also tdf#146199.

Change-Id: I38541bfb35eae36681af84e73a7965d36152448f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138145
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 9d71560c108b..d712dfa5 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -75,6 +75,8 @@
 
 #include 
 
+#include 
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
@@ -254,19 +256,93 @@ static Point lcl_ImplCalcRotatedPos( Point rPos, Point 
rOrigin, double nSin, dou
 return aTranslatedPos;
 }
 
-static bool lcl_IsLigature( sal_Unicode cCh, sal_Unicode cNextCh ) // For 
Kashidas from sw/source/core/text/porlay.txt
+// For Kashidas from sw/source/core/text/porlay.cxx
+
+#define IS_JOINING_GROUP(c, g) ( u_getIntPropertyValue( (c), 
UCHAR_JOINING_GROUP ) == U_JG_##g )
+#define isAinChar(c)IS_JOINING_GROUP((c), AIN)
+#define isAlefChar(c)   IS_JOINING_GROUP((c), ALEF)
+#define isDalChar(c)IS_JOINING_GROUP((c), DAL)
+#if U_ICU_VERSION_MAJOR_NUM >= 58
+#define isFehChar(c)   (IS_JOINING_GROUP((c), FEH) || 
IS_JOINING_GROUP((c), AFRICAN_FEH))
+#else
+#define isFehChar(c)IS_JOINING_GROUP((c), FEH)
+#endif
+#define isGafChar(c)IS_JOINING_GROUP((c), GAF)
+#define isHehChar(c)IS_JOINING_GROUP((c), HEH)
+#define isKafChar(c)IS_JOINING_GROUP((c), KAF)
+#define isLamChar(c)IS_JOINING_GROUP((c), LAM)
+#if U_ICU_VERSION_MAJOR_NUM >= 58
+#define isQafChar(c)   (IS_JOINING_GROUP((c), QAF) || 
IS_JOINING_GROUP((c), AFRICAN_QAF))
+#else
+#define isQafChar(c)IS_JOINING_GROUP((c), QAF)
+#endif
+#define isRehChar(c)IS_JOINING_GROUP((c), REH)
+#define isTahChar(c)IS_JOINING_GROUP((c), TAH)
+#define isTehMarbutaChar(c) IS_JOINING_GROUP((c), TEH_MARBUTA)
+#define isWawChar(c)IS_JOINING_GROUP((c), WAW)
+#define isSeenOrSadChar(c)  (IS_JOINING_GROUP((c), SAD) || 
IS_JOINING_GROUP((c), SEEN))
+
+// Beh and characters that behave like Beh in medial form.
+static bool isBehChar(sal_Unicode cCh)
+{
+bool bRet = false;
+switch (u_getIntPropertyValue(cCh, UCHAR_JOINING_GROUP))
+{
+case U_JG_BEH:
+case U_JG_NOON:
+#if U_ICU_VERSION_MAJOR_NUM >= 58
+case U_JG_AFRICAN_NOON:
+#endif
+case U_JG_NYA:
+case U_JG_YEH:
+case U_JG_FARSI_YEH:
+case U_JG_BURUSHASKI_YEH_BARREE:
+bRet = true;
+break;
+default:
+bRet = false;
+break;
+}
+
+return bRet;
+}
+
+// Yeh and characters that behave like Yeh in final form.
+static bool isYehChar(sal_Unicode cCh)
+{
+bool bRet = false;
+switch (u_getIntPropertyValue(cCh, UCHAR_JOINING_GROUP))
+{
+case U_JG_YEH:
+case U_JG_FARSI_YEH:
+case U_JG_YEH_BARREE:
+case U_JG_BURUSHASKI_YEH_BARREE:
+case U_JG_YEH_WITH_TAIL:
+bRet = true;
+break;
+default:
+bRet = false;
+break;
+}
+
+return bRet;
+}
+
+static bool isTransparentChar ( sal_Unicode cCh )
+{
+return u_getIntPropertyValue( cCh, UCHAR_JOINING_TYPE ) == 
U_JT_TRANSPARENT;
+}
+
+static bool lcl_IsLigature( sal_Unicode cCh, sal_Unicode cNextCh )
 {
 // Lam + Alef
-return ( 0x644 == cCh && 0x627 == cNextCh ) ||
-// Beh + Reh
-   ( 0x628 == cCh && 0x631 == cNextCh );
+return ( isLamChar ( cCh ) && isAlefChar ( cNextCh ));
 }
 
-static bool lcl_ConnectToPrev( sal_Unicode cCh, sal_Unicode cPrevCh )  // For 
Kashidas from sw/source/core/text/porlay.txt
+static bool lcl_ConnectToPrev( sal_Unicode cCh, sal_Unicode cPrevCh )
 {
-// Alef, Dal, Thal, Reh, Zain, and Waw do not connect to the left
-bool bRet = 0x627 != cPrevCh && 0x62F != cPrevCh && 0x630 != cPrevCh &&
-0x631 != cPrevCh && 0x632 != cPrevCh && 0x648 != cPrevCh;
+const int32_t nJoiningType = u_getIntPropertyValue( cPrevCh, 
UCHAR_JOINING_TYPE );
+bool bRet = nJoiningType != U_JT_RIGHT_JOINING && nJoiningType != 
U_JT_NON_JOINING;
 
 // check for ligatures cPrevChar + cChar
 if ( bRet )
@@ -2236,8 +2312,15 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
 pLine->SetTextWidth( pLine->GetTextWidth() + 

[Libreoffice-commits] core.git: canvas/source drawinglayer/source editeng/inc editeng/source emfio/source include/drawinglayer include/editeng include/vcl sc/source sd/source sfx2/source svgio/source

2022-08-14 Thread Khaled Hosny (via logerrit)
 canvas/source/cairo/cairo_textlayout.cxx  |2 
 canvas/source/directx/dx_textlayout_drawhelper.cxx|1 
 canvas/source/vcl/textlayout.cxx  |1 
 drawinglayer/source/primitive2d/textbreakuphelper.cxx |   10 +
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx  |7 
 drawinglayer/source/primitive2d/textlayoutdevice.cxx  |6 
 drawinglayer/source/primitive2d/textprimitive2d.cxx   |   13 -
 drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx  |1 
 drawinglayer/source/processor2d/vclprocessor2d.cxx|3 
 drawinglayer/source/tools/emfphelperdata.cxx  |4 
 drawinglayer/source/tools/wmfemfhelper.cxx|7 
 editeng/inc/editdoc.hxx   |4 
 editeng/source/editeng/editeng.cxx|3 
 editeng/source/editeng/impedit3.cxx   |   33 ++-
 editeng/source/items/svxfont.cxx  |   13 -
 editeng/source/outliner/outleeng.cxx  |5 
 editeng/source/outliner/outleeng.hxx  |3 
 editeng/source/outliner/outliner.cxx  |9 
 emfio/source/reader/mtftools.cxx  |4 
 include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx |2 
 include/drawinglayer/primitive2d/textlayoutdevice.hxx |3 
 include/drawinglayer/primitive2d/textprimitive2d.hxx  |8 
 include/editeng/editeng.hxx   |4 
 include/editeng/outliner.hxx  |7 
 include/editeng/svxfont.hxx   |3 
 include/vcl/metaact.hxx   |   11 -
 include/vcl/outdev.hxx|   12 -
 include/vcl/pdfwriter.hxx |1 
 include/vcl/rendercontext/SalLayoutFlags.hxx  |3 
 sc/source/ui/view/hintwin.cxx |4 
 sd/source/ui/view/sdview.cxx  |1 
 sfx2/source/control/thumbnailviewitem.cxx |1 
 svgio/source/svgreader/svgcharacternode.cxx   |2 
 svtools/source/control/ruler.cxx  |4 
 svx/source/diagram/IDiagramHelper.cxx |3 
 svx/source/svdraw/svdotextdecomposition.cxx   |   14 +
 svx/source/svdraw/svdotextpathdecomposition.cxx   |5 
 svx/source/tbxctrls/StylesPreviewWindow.cxx   |3 
 sw/source/core/inc/scriptinfo.hxx |2 
 sw/source/core/layout/paintfrm.cxx|1 
 sw/source/core/text/itradj.cxx|6 
 sw/source/core/text/porlay.cxx|6 
 sw/source/core/text/portxt.cxx|2 
 sw/source/core/txtnode/fntcache.cxx   |   32 ++-
 sw/source/uibase/docvw/HeaderFooterWin.cxx|2 
 sw/source/uibase/docvw/UnfloatTableButton.cxx |2 
 vcl/inc/ImplLayoutArgs.hxx|2 
 vcl/inc/impglyphitem.hxx  |4 
 vcl/inc/pdf/pdfwriter_impl.hxx|2 
 vcl/inc/sallayout.hxx |2 
 vcl/qa/cppunit/complextext.cxx|   37 ---
 vcl/qa/cppunit/svm/svmtest.cxx|2 
 vcl/qa/cppunit/text.cxx   |2 
 vcl/source/control/imp_listbox.cxx|2 
 vcl/source/filter/eps/eps.cxx |   12 -
 vcl/source/filter/svm/SvmConverter.cxx|2 
 vcl/source/gdi/CommonSalLayout.cxx|   98 +++---
 vcl/source/gdi/gdimtf.cxx |4 
 vcl/source/gdi/impglyphitem.cxx   |   25 --
 vcl/source/gdi/metaact.cxx|   12 +
 vcl/source/gdi/pdfwriter.cxx  |3 
 vcl/source/gdi/pdfwriter_impl.cxx |8 
 vcl/source/gdi/pdfwriter_impl2.cxx|2 
 vcl/source/gdi/textlayout.cxx |2 
 vcl/source/outdev/text.cxx|   42 ++--
 vcl/source/outdev/transparent.cxx |2 
 vcl/source/text/ImplLayoutArgs.cxx|   32 +++
 vcl/source/window/menuitemlist.cxx|2 
 vcl/source/window/status.cxx  |2 
 69 files changed, 346 insertions(+), 228 deletions(-)

New 

[Libreoffice-commits] core.git: configure.ac

2022-08-05 Thread Khaled Hosny (via logerrit)
 configure.ac |   20 
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit b7c1f13eca14836ce3427afb79cae1101661461c
Author: Khaled Hosny 
AuthorDate: Mon Aug 1 00:23:22 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Aug 5 09:51:37 2022 +0200

vcl: Add a configure option to set VCL_FLOAT_DEVICE_PIXEL

Disabled by default. It might improve sub-pixel glyph positioning a bit,
though it is only used inside VCL and the API boundary is still
sal_Int32, sound rounding to full pixels still happens at some point.

Change-Id: I702f9a521e5b556d198756d6cdbb455ebaffbab4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137664
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/configure.ac b/configure.ac
index 80150dcb725c..851c2afe9b94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2039,6 +2039,11 @@ AC_ARG_ENABLE(customtarget-components,
 AS_HELP_STRING([--enable-customtarget-components],
 [Generates the static UNO object constructor mapping from the build.]))
 
+AC_ARG_ENABLE(float_device_pixel,
+AS_HELP_STRING([--enable-float-device-pixel],
+   [Uses doubles for VCL device coordinates instead of 32-bit 
integers.]),
+,)
+
 dnl ===
 dnl Optional Packages (--with/without-)
 dnl ===
@@ -11666,14 +11671,13 @@ dnl 
===
 dnl Set vcl option: coordinate device in double or sal_Int32
 dnl ===
 
-dnl disabled for now, we don't want subtle differences between OSs
-dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
-dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
-dnl AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
-dnl AC_MSG_RESULT([double])
-dnl else
-dnl AC_MSG_RESULT([sal_Int32])
-dnl fi
+AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
+if test "$enable_float_device_pixel" = yes; then
+AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
+AC_MSG_RESULT([double])
+else
+AC_MSG_RESULT([sal_Int32])
+fi
 
 dnl ===
 dnl Show which vclplugs will be built.


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - download.lst external/more_fonts vcl/qa

2022-08-03 Thread Khaled Hosny (via logerrit)
 download.lst|4 ++--
 external/more_fonts/ExternalPackage_reem.mk |1 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit da5c72ae37c2620bdab13bd0154d97aa53f9a331
Author: Khaled Hosny 
AuthorDate: Sun Jul 31 23:50:18 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Aug 3 15:37:00 2022 +0200

more_fonts: Update Reem Kufi

Also update test expectation due to changed glyph order.

Change-Id: I8f6d1a057077cb6de5e5d7fce4bec29929edb8b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137663
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit f1540e05327873a73c0bbb232689d2be5c0072b7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137610
Reviewed-by: خالد حسني 
Reviewed-by: Adolfo Jayme Barrientos 
(cherry picked from commit 15da0f9b805e090e61b2eb82913130d7a77d16c6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137714

diff --git a/download.lst b/download.lst
index 3b2abd992c44..6ae8868c51b2 100644
--- a/download.lst
+++ b/download.lst
@@ -90,8 +90,8 @@ export FONT_AMIRI_SHA256SUM := 
9c4e768893e0023a0ad6f488d5c84bd5add6565d3dcadb838
 export FONT_AMIRI_TARBALL := Amiri-0.117.zip
 export FONT_KACST_SHA256SUM := 
dca00f5e655f2f217a766faa73a81f542c5c204aa3a47017c3c2be0b31d00a56
 export FONT_KACST_TARBALL := ttf-kacst_2.01+mry.tar.gz
-export FONT_REEM_SHA256SUM := 
f60c6508d209ce4236d2d7324256c2ffddd480be7e3d6023770b93dc391a605f
-export FONT_REEM_TARBALL := ReemKufi-0.7.zip
+export FONT_REEM_SHA256SUM := 
c4fd68a23c0ea471cc084ae7efe888da372b925cb208eeb0322c26792d2ef413
+export FONT_REEM_TARBALL := ReemKufi-1.2.zip
 export FONT_SCHEHERAZADE_SHA256SUM := 
251c8817ceb87d9b661ce1d5b49e732a0116add10abc046be4b8ba5196e149b5
 export FONT_SCHEHERAZADE_TARBALL := Scheherazade-2.100.zip
 export FREEHAND_SHA256SUM := 
0e422d1564a6dbf22a9af598535425271e583514c0f7ba7d9091676420de34ac
diff --git a/external/more_fonts/ExternalPackage_reem.mk 
b/external/more_fonts/ExternalPackage_reem.mk
index 9a40652b55cc..bc26cecc7dfe 100644
--- a/external/more_fonts/ExternalPackage_reem.mk
+++ b/external/more_fonts/ExternalPackage_reem.mk
@@ -11,6 +11,7 @@ $(eval $(call 
gb_ExternalPackage_ExternalPackage,fonts_reem,font_reem))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,fonts_reem,$(LIBO_SHARE_FOLDER)/fonts/truetype,\
ttf/ReemKufi-Regular.ttf \
+   ttf/ReemKufi-Bold.ttf \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 8ceac70b1ce5..a3b351056228 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1329,8 +1329,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2)
   "<05> <0647>\n"
   "<06> <062F>\n"
   "<08> <062C>\n"
-  "<09> <0628>\n"
-  "<0B> <0623>\n"
+  "<0A> <0628>\n"
+  "<0C> <0623>\n"
   "endbfchar");
 std::string aData(static_cast(aObjectStream.GetData()),
   aObjectStream.GetSize());


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - download.lst vcl/qa

2022-08-03 Thread Khaled Hosny (via logerrit)
 download.lst |4 ++--
 vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |   14 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit b2acb3d8256eda53f08574868050bda4f4318daf
Author: Khaled Hosny 
AuthorDate: Sun Jul 31 23:42:41 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Aug 3 13:49:59 2022 +0200

more_fonts: Update Amiri

Update PDF export test that depends on a mapping the font no longer has,
and use different characters that meet the test criteria.

Change-Id: I0f89297a52ffcef3513e0a788ec3bab645cc354b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137661
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit 660c14d12592fdc1bd566398d272e0e8b1affe89)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137611
Reviewed-by: خالد حسني 
Reviewed-by: Adolfo Jayme Barrientos 
(cherry picked from commit ab355fde048052ace3a37e9b499ef321e0835546)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137715

diff --git a/download.lst b/download.lst
index 316bdf1a695b..3b2abd992c44 100644
--- a/download.lst
+++ b/download.lst
@@ -86,8 +86,8 @@ export FONT_LIBRE_HEBREW_SHA256SUM := 
f596257c1db706ce35795b18d7f66a4db99d427725
 export FONT_LIBRE_HEBREW_TARBALL := libre-hebrew-1.0.tar.gz
 export FONT_ALEF_SHA256SUM := 
b98b67602a2c8880a1770f0b9e37c190f29a7e2ade5616784f0b89fbdb75bf52
 export FONT_ALEF_TARBALL := alef-1.001.tar.gz
-export FONT_AMIRI_SHA256SUM := 
1fbfccced6348b5db2c1c21d5b319cd488e14d055702fa817a0f6cb83d882166
-export FONT_AMIRI_TARBALL := Amiri-0.111.zip
+export FONT_AMIRI_SHA256SUM := 
9c4e768893e0023a0ad6f488d5c84bd5add6565d3dcadb838ba5b20e75fcc9a7
+export FONT_AMIRI_TARBALL := Amiri-0.117.zip
 export FONT_KACST_SHA256SUM := 
dca00f5e655f2f217a766faa73a81f542c5c204aa3a47017c3c2be0b31d00a56
 export FONT_KACST_TARBALL := ttf-kacst_2.01+mry.tar.gz
 export FONT_REEM_SHA256SUM := 
f60c6508d209ce4236d2d7324256c2ffddd480be7e3d6023770b93dc391a605f
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt 
b/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt
index 7fecc55c6386..e5cc9bc0b3cc 100644
Binary files a/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt and 
b/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index a399986626b0..8ceac70b1ce5 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1225,13 +1225,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1)
 aZCodec.Decompress(pStream->GetMemory(), aObjectStream);
 CPPUNIT_ASSERT(aZCodec.EndCompression());
 aObjectStream.Seek(0);
-// The <01> is glyph id, <0020> is code point.
-// The document has three characters , but the 
font
-// reuses the same glyph for space and nbspace so we should have a 
single
-// CMAP entry for the space, and nbspace will be handled with 
ActualText
-// (tested above).
+// The <01> is glyph id, <2044> is code point.
+// The document has two characters <2044><2215><2044>, but the font
+// reuses the same glyph for U+2044 and U+2215 so we should have a 
single
+// CMAP entry for the U+2044, and U+2215 will be handled with 
ActualText
+// (tested below).
 std::string aCmap("1 beginbfchar\n"
-  "<01> <0020>\n"
+  "<01> <2044>\n"
   "endbfchar");
 std::string aData(static_cast(aObjectStream.GetData()),
   aObjectStream.GetSize());
@@ -1272,7 +1272,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("The should be one ActualText entry!", 
static_cast(1),
  nCount);
 
-aActualText = "/Span<>>";
+aActualText = "/Span<>>";
 nPos = aData.find(aActualText);
 CPPUNIT_ASSERT_MESSAGE("ActualText not found!", nPos != 
std::string::npos);
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - download.lst external/more_fonts vcl/qa

2022-08-02 Thread Khaled Hosny (via logerrit)
 download.lst|4 ++--
 external/more_fonts/ExternalPackage_reem.mk |1 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 15da0f9b805e090e61b2eb82913130d7a77d16c6
Author: Khaled Hosny 
AuthorDate: Sun Jul 31 23:50:18 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Aug 2 13:38:17 2022 +0200

more_fonts: Update Reem Kufi

Also update test expectation due to changed glyph order.

Change-Id: I8f6d1a057077cb6de5e5d7fce4bec29929edb8b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137663
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit f1540e05327873a73c0bbb232689d2be5c0072b7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137610
Reviewed-by: خالد حسني 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/download.lst b/download.lst
index d4a89ddf35c7..5d487b0efb89 100644
--- a/download.lst
+++ b/download.lst
@@ -86,8 +86,8 @@ export FONT_AMIRI_SHA256SUM := 
9c4e768893e0023a0ad6f488d5c84bd5add6565d3dcadb838
 export FONT_AMIRI_TARBALL := Amiri-0.117.zip
 export FONT_KACST_SHA256SUM := 
dca00f5e655f2f217a766faa73a81f542c5c204aa3a47017c3c2be0b31d00a56
 export FONT_KACST_TARBALL := ttf-kacst_2.01+mry.tar.gz
-export FONT_REEM_SHA256SUM := 
f60c6508d209ce4236d2d7324256c2ffddd480be7e3d6023770b93dc391a605f
-export FONT_REEM_TARBALL := ReemKufi-0.7.zip
+export FONT_REEM_SHA256SUM := 
c4fd68a23c0ea471cc084ae7efe888da372b925cb208eeb0322c26792d2ef413
+export FONT_REEM_TARBALL := ReemKufi-1.2.zip
 export FONT_SCHEHERAZADE_SHA256SUM := 
251c8817ceb87d9b661ce1d5b49e732a0116add10abc046be4b8ba5196e149b5
 export FONT_SCHEHERAZADE_TARBALL := Scheherazade-2.100.zip
 export FREEHAND_SHA256SUM := 
0e422d1564a6dbf22a9af598535425271e583514c0f7ba7d9091676420de34ac
diff --git a/external/more_fonts/ExternalPackage_reem.mk 
b/external/more_fonts/ExternalPackage_reem.mk
index 9a40652b55cc..bc26cecc7dfe 100644
--- a/external/more_fonts/ExternalPackage_reem.mk
+++ b/external/more_fonts/ExternalPackage_reem.mk
@@ -11,6 +11,7 @@ $(eval $(call 
gb_ExternalPackage_ExternalPackage,fonts_reem,font_reem))
 
 $(eval $(call 
gb_ExternalPackage_add_unpacked_files,fonts_reem,$(LIBO_SHARE_FOLDER)/fonts/truetype,\
ttf/ReemKufi-Regular.ttf \
+   ttf/ReemKufi-Bold.ttf \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 254d55c218b3..03aed3112d64 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1434,8 +1434,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2)
   "<05> <0647>\n"
   "<06> <062F>\n"
   "<08> <062C>\n"
-  "<09> <0628>\n"
-  "<0B> <0623>\n"
+  "<0A> <0628>\n"
+  "<0C> <0623>\n"
   "endbfchar");
 std::string aData(static_cast(aObjectStream.GetData()),
   aObjectStream.GetSize());


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - download.lst vcl/qa

2022-08-02 Thread Khaled Hosny (via logerrit)
 download.lst |4 ++--
 vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |   14 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit ab355fde048052ace3a37e9b499ef321e0835546
Author: Khaled Hosny 
AuthorDate: Sun Jul 31 23:42:41 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Aug 2 13:37:50 2022 +0200

more_fonts: Update Amiri

Update PDF export test that depends on a mapping the font no longer has,
and use different characters that meet the test criteria.

Change-Id: I0f89297a52ffcef3513e0a788ec3bab645cc354b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137661
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit 660c14d12592fdc1bd566398d272e0e8b1affe89)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137611
Reviewed-by: خالد حسني 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/download.lst b/download.lst
index 257c1248bd0e..d4a89ddf35c7 100644
--- a/download.lst
+++ b/download.lst
@@ -82,8 +82,8 @@ export FONT_LIBRE_HEBREW_SHA256SUM := 
f596257c1db706ce35795b18d7f66a4db99d427725
 export FONT_LIBRE_HEBREW_TARBALL := libre-hebrew-1.0.tar.gz
 export FONT_ALEF_SHA256SUM := 
b98b67602a2c8880a1770f0b9e37c190f29a7e2ade5616784f0b89fbdb75bf52
 export FONT_ALEF_TARBALL := alef-1.001.tar.gz
-export FONT_AMIRI_SHA256SUM := 
1fbfccced6348b5db2c1c21d5b319cd488e14d055702fa817a0f6cb83d882166
-export FONT_AMIRI_TARBALL := Amiri-0.111.zip
+export FONT_AMIRI_SHA256SUM := 
9c4e768893e0023a0ad6f488d5c84bd5add6565d3dcadb838ba5b20e75fcc9a7
+export FONT_AMIRI_TARBALL := Amiri-0.117.zip
 export FONT_KACST_SHA256SUM := 
dca00f5e655f2f217a766faa73a81f542c5c204aa3a47017c3c2be0b31d00a56
 export FONT_KACST_TARBALL := ttf-kacst_2.01+mry.tar.gz
 export FONT_REEM_SHA256SUM := 
f60c6508d209ce4236d2d7324256c2ffddd480be7e3d6023770b93dc391a605f
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt 
b/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt
index 7fecc55c6386..e5cc9bc0b3cc 100644
Binary files a/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt and 
b/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index d77cc4a4b00d..254d55c218b3 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1330,13 +1330,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1)
 aZCodec.Decompress(pStream->GetMemory(), aObjectStream);
 CPPUNIT_ASSERT(aZCodec.EndCompression());
 aObjectStream.Seek(0);
-// The <01> is glyph id, <0020> is code point.
-// The document has three characters , but the 
font
-// reuses the same glyph for space and nbspace so we should have a 
single
-// CMAP entry for the space, and nbspace will be handled with 
ActualText
-// (tested above).
+// The <01> is glyph id, <2044> is code point.
+// The document has two characters <2044><2215><2044>, but the font
+// reuses the same glyph for U+2044 and U+2215 so we should have a 
single
+// CMAP entry for the U+2044, and U+2215 will be handled with 
ActualText
+// (tested below).
 std::string aCmap("1 beginbfchar\n"
-  "<01> <0020>\n"
+  "<01> <2044>\n"
   "endbfchar");
 std::string aData(static_cast(aObjectStream.GetData()),
   aObjectStream.GetSize());
@@ -1377,7 +1377,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("The should be one ActualText entry!", 
static_cast(1),
  nCount);
 
-aActualText = "/Span<>>";
+aActualText = "/Span<>>";
 nPos = aData.find(aActualText);
 CPPUNIT_ASSERT_MESSAGE("ActualText not found!", nPos != 
std::string::npos);
 }


[Libreoffice-commits] core.git: 2 commits - download.lst external/more_fonts vcl/qa

2022-08-02 Thread Khaled Hosny (via logerrit)
 download.lst |8 
 external/more_fonts/ExternalPackage_reem.mk  |1 +
 vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |   18 +-
 4 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit c010c1375bfec3aaa7d154c7164ae31df556cb68
Author: Khaled Hosny 
AuthorDate: Sun Jul 31 23:42:41 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Aug 2 12:13:14 2022 +0200

more_fonts: Update Amiri

Update PDF export test that depends on a mapping the font no longer has,
and use different characters that meet the test criteria.

Change-Id: I0f89297a52ffcef3513e0a788ec3bab645cc354b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137661
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/download.lst b/download.lst
index 48db7812cc00..96db5d48e9f7 100644
--- a/download.lst
+++ b/download.lst
@@ -82,8 +82,8 @@ export FONT_LIBRE_HEBREW_SHA256SUM := 
f596257c1db706ce35795b18d7f66a4db99d427725
 export FONT_LIBRE_HEBREW_TARBALL := libre-hebrew-1.0.tar.gz
 export FONT_ALEF_SHA256SUM := 
b98b67602a2c8880a1770f0b9e37c190f29a7e2ade5616784f0b89fbdb75bf52
 export FONT_ALEF_TARBALL := alef-1.001.tar.gz
-export FONT_AMIRI_SHA256SUM := 
1fbfccced6348b5db2c1c21d5b319cd488e14d055702fa817a0f6cb83d882166
-export FONT_AMIRI_TARBALL := Amiri-0.111.zip
+export FONT_AMIRI_SHA256SUM := 
9c4e768893e0023a0ad6f488d5c84bd5add6565d3dcadb838ba5b20e75fcc9a7
+export FONT_AMIRI_TARBALL := Amiri-0.117.zip
 export FONT_KACST_SHA256SUM := 
dca00f5e655f2f217a766faa73a81f542c5c204aa3a47017c3c2be0b31d00a56
 export FONT_KACST_TARBALL := ttf-kacst_2.01+mry.tar.gz
 export FONT_REEM_SHA256SUM := 
c4fd68a23c0ea471cc084ae7efe888da372b925cb208eeb0322c26792d2ef413
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt 
b/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt
index 7fecc55c6386..e5cc9bc0b3cc 100644
Binary files a/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt and 
b/vcl/qa/cppunit/pdfexport/data/tdf66597-1.odt differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index b335d395eb49..03aed3112d64 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1330,13 +1330,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1)
 aZCodec.Decompress(pStream->GetMemory(), aObjectStream);
 CPPUNIT_ASSERT(aZCodec.EndCompression());
 aObjectStream.Seek(0);
-// The <01> is glyph id, <0020> is code point.
-// The document has three characters , but the 
font
-// reuses the same glyph for space and nbspace so we should have a 
single
-// CMAP entry for the space, and nbspace will be handled with 
ActualText
-// (tested above).
+// The <01> is glyph id, <2044> is code point.
+// The document has two characters <2044><2215><2044>, but the font
+// reuses the same glyph for U+2044 and U+2215 so we should have a 
single
+// CMAP entry for the U+2044, and U+2215 will be handled with 
ActualText
+// (tested below).
 std::string aCmap("1 beginbfchar\n"
-  "<01> <0020>\n"
+  "<01> <2044>\n"
   "endbfchar");
 std::string aData(static_cast(aObjectStream.GetData()),
   aObjectStream.GetSize());
@@ -1377,7 +1377,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("The should be one ActualText entry!", 
static_cast(1),
  nCount);
 
-aActualText = "/Span<>>";
+aActualText = "/Span<>>";
 nPos = aData.find(aActualText);
 CPPUNIT_ASSERT_MESSAGE("ActualText not found!", nPos != 
std::string::npos);
 }
commit 44aa6bb9b7d2abeb10731cb0e1b7b52c1a79b7a3
Author: Khaled Hosny 
AuthorDate: Sun Jul 31 23:50:18 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Aug 2 12:13:06 2022 +0200

more_fonts: Update Reem Kufi

Also update test expectation due to changed glyph order.

Change-Id: I8f6d1a057077cb6de5e5d7fce4bec29929edb8b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137663
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/download.lst b/download.lst
index 418226979157..48db7812cc00 100644
--- a/download.lst
+++ b/download.lst
@@ -86,8 +86,8 @@ export FONT_AMIRI_SHA256SUM := 
1fbfccced6348b5db2c1c21d5b319cd488e14d055702fa817
 export FONT_AMIRI_TARBALL := Amiri-0.111.zip
 export FONT_KACST_SHA256SUM := 
dca00f5e655f2f217a766faa73a81f542c5c204aa3a47017c3c2be0b31d00a56
 export FONT_KACST_TARBALL := ttf-kacst_2.01+mry.tar.gz
-export FONT_REEM_SHA256SUM := 
f60c6508d209ce4236d2d7324256c2ffddd480be7e3d6023770b93dc391a605f
-export FONT_REEM_TARBALL := ReemKufi-0.7.zip
+export FONT_REEM_SHA256SUM := 

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

2022-06-09 Thread Khaled Hosny (via logerrit)
 vcl/inc/pdf/pdfwriter_impl.hxx  |8 +--
 vcl/source/gdi/pdfwriter_impl.cxx   |   23 +++-
 vcl/source/gdi/salgdilayout.cxx |   23 +++-
 vcl/unx/generic/fontmanager/fontmanager.cxx |   31 +++-
 4 files changed, 53 insertions(+), 32 deletions(-)

New commits:
commit be39eba9a3d81e20c42f1073a365e91ce855c1cd
Author: Khaled Hosny 
AuthorDate: Mon Jun 6 00:17:02 2022 +0200
Commit: Caolán McNamara 
CommitDate: Thu Jun 9 10:03:51 2022 +0200

Use same glyph width in PDF drawing and font subset

During PDF drawing we already know the glyph width, but when subsetting
we get it again from the font subset.

For fonts without CFF table this is redundant but harmless, but for
fonts with CFF table, if the CFF and hmtx table (the authoritative
source of glyph widths) disagree, we will be drawing the PDF string with
the wrong adjustment resulting in displaced glyphs. This is a font bug,
but avoiding redundancy and having one source of truth is an improvement
overall.

I kept the code that calculates advance widths for font subsets, just in
case it is is still used elsewhere.

Change-Id: I757cd0c2ebb6477b2f840d0005e84b5a131f7efb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135442
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index ae461895a55b..869ba7883458 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -287,15 +287,19 @@ class GlyphEmit
 // performance: actually this should probably a vector;
 std::vectorm_CodeUnits;
 sal_uInt8   m_nSubsetGlyphID;
+sal_Int32   m_nGlyphWidth;
 
 public:
-GlyphEmit() : m_nSubsetGlyphID(0)
+GlyphEmit() : m_nSubsetGlyphID(0), m_nGlyphWidth(0)
 {
 }
 
 void setGlyphId( sal_uInt8 i_nId ) { m_nSubsetGlyphID = i_nId; }
 sal_uInt8 getGlyphId() const { return m_nSubsetGlyphID; }
 
+void setGlyphWidth( sal_Int32 nWidth ) { m_nGlyphWidth = nWidth; }
+sal_Int32 getGlyphWidth() const { return m_nGlyphWidth; }
+
 void addCode( sal_Ucs i_cCode )
 {
 m_CodeUnits.push_back(i_cCode);
@@ -817,7 +821,7 @@ i12626
 void appendLiteralStringEncrypt( std::string_view rInString, const 
sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer );
 
 /* creates fonts and subsets that will be emitted later */
-void registerGlyph(const GlyphItem* pGlyph, const 
vcl::font::PhysicalFontFace* pFont, const std::vector& rCodeUnits, 
sal_uInt8& nMappedGlyph, sal_Int32& nMappedFontObject);
+void registerGlyph(const GlyphItem* pGlyph, const 
vcl::font::PhysicalFontFace* pFont, const std::vector& rCodeUnits, 
sal_Int32 nGlyphWidth, sal_uInt8& nMappedGlyph, sal_Int32& nMappedFontObject);
 
 /*  emits a text object according to the passed layout */
 /* TODO: remove rText as soon as SalLayout will change so that rText is 
not necessary anymore */
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 23ca498ea73b..4ae1d9f5d242 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2681,6 +2681,7 @@ bool PDFWriterImpl::emitFonts()
 pEncoding[ nEnc ] = nEnc;
 pEncToUnicodeIndex[ nEnc ] = 
static_cast(aCodeUnits.size());
 pCodeUnitsPerGlyph[ nEnc ] = item.second.countCodes();
+pWidths[ nEnc ] = item.second.getGlyphWidth();
 for( sal_Int32 n = 0; n < pCodeUnitsPerGlyph[ nEnc ]; n++ )
 aCodeUnits.push_back( item.second.getCode( n ) );
 if( item.second.getCode(0) )
@@ -2693,7 +2694,7 @@ bool PDFWriterImpl::emitFonts()
 }
 }
 FontSubsetInfo aSubsetInfo;
-if( pGraphics->CreateFontSubset( aTmpName, subset.first, 
aGlyphIds, pEncoding, pWidths, nGlyphs, aSubsetInfo ) )
+if( pGraphics->CreateFontSubset( aTmpName, subset.first, 
aGlyphIds, pEncoding, nullptr, nGlyphs, aSubsetInfo ) )
 {
 // create font stream
 osl::File aFontFile(aTmpName);
@@ -3901,9 +3902,17 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( 
PDFWidget& rBox, const PDFW
 const GlyphItem aItem(0, 0, pMap->GetGlyphIndex(cMark),
   DevicePoint(), GlyphItemFlags::NONE, 0, 0, 0);
 const std::vector aCodeUnits={ cMark };
+sal_Int32 nGlyphWidth = 0;
+SalGraphics *pGraphics = GetGraphics();
+if (pGraphics)
+nGlyphWidth = m_aFontCache.getGlyphWidth(pDevFont,
+ aItem.glyphId(),
+ aItem.IsVertical(),
+ pGraphics);
+
 sal_uInt8 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/inc vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win

2021-03-24 Thread Khaled Hosny (via logerrit)
 vcl/inc/impfontmetricdata.hxx  |5 +---
 vcl/inc/sft.hxx|4 +--
 vcl/qt5/Qt5Graphics_Text.cxx   |8 --
 vcl/quartz/ctfonts.cxx |   18 ---
 vcl/source/font/fontmetric.cxx |   21 +
 vcl/source/fontsubset/sft.cxx  |   30 -
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |   10 
 vcl/win/gdi/salfont.cxx|   10 
 8 files changed, 39 insertions(+), 67 deletions(-)

New commits:
commit f01125c01298148b93f0783c01806c6a6ff4c3e2
Author: Khaled Hosny 
AuthorDate: Sun Aug 25 14:12:15 2019 +0200
Commit: Aron Budea 
CommitDate: Wed Mar 24 16:20:04 2021 +0100

Consolidate ImplCalcLineSpacing()

Move getting UPEM and font tables to the functions and use HarfBuzz API
to get them. In the future we might stop reading the tables ourselves
and use HarfBuzz metrics API instead.

Change-Id: I3f4511628fd33200bae94cdcd96479ba3e6d2fba
Reviewed-on: https://gerrit.libreoffice.org/78081
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 
(cherry picked from commit 60d4be99383b6fe13ca55572c43fd022bdc73ce8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112484
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index 1c9b14a5098f..2093b18c53e8 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -32,6 +32,7 @@ typedef tools::SvRef 
ImplFontMetricDataRef;
 
 class OutputDevice;
 class FontSelectPattern;
+class LogicalFontInstance;
 
 class VCL_DLLPUBLIC ImplFontMetricData : public FontAttributes, public 
SvRefBase
 {
@@ -92,9 +93,7 @@ public:
 voidImplInitTextLineSize( const OutputDevice* pDev );
 voidImplInitAboveTextLineSize();
 voidImplInitFlags( const OutputDevice* pDev );
-voidImplCalcLineSpacing(const std::vector& rHhea,
-const std::vector& rOS_2,
-int nUPEM);
+voidImplCalcLineSpacing(LogicalFontInstance *pFontInstance);
 
 private:
 boolShouldUseWinMetrics(vcl::TTGlobalFontInfo& rInfo);
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 95fbcadb0d8d..06d214b8d391 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -423,8 +423,8 @@ namespace vcl
  * @ingroup sft
  *
  */
- void GetTTFontMetrics(const std::vector& hhea,
-   const std::vector& os2,
+ void GetTTFontMetrics(const uint8_t *pHhea, size_t nHhea,
+   const uint8_t *pOs2, size_t nOs2,
TTGlobalFontInfo *info);
 
 /**
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 67cef5962dad..849987187ee9 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -59,13 +59,7 @@ void Qt5Graphics::GetFontMetric(ImplFontMetricDataRef& rFMD, 
int nFallbackLevel)
 QRawFont aRawFont(QRawFont::fromFont(*m_pTextStyle[nFallbackLevel]));
 Qt5FontFace::fillAttributesFromQFont(*m_pTextStyle[nFallbackLevel], *rFMD);
 
-QByteArray aHheaTable = aRawFont.fontTable("hhea");
-std::vector rHhea(aHheaTable.data(), aHheaTable.data() + 
aHheaTable.size());
-
-QByteArray aOs2Table = aRawFont.fontTable("OS/2");
-std::vector rOS2(aOs2Table.data(), aOs2Table.data() + 
aOs2Table.size());
-
-rFMD->ImplCalcLineSpacing(rHhea, rOS2, aRawFont.unitsPerEm());
+rFMD->ImplCalcLineSpacing(m_pTextStyle[nFallbackLevel].get());
 
 rFMD->SetSlant(0);
 rFMD->SetWidth(aRawFont.averageCharWidth());
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 03582bf9cf3d..755de2148e71 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -110,24 +110,8 @@ void CoreTextStyle::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 ));
-const CoreTextFontFace* mpFontData = static_cast(GetFontFace());
 
-int nBufSize = 0;
-
-nBufSize = mpFontData->GetFontTable("hhea", nullptr);
-uint8_t* pHheaBuf = new uint8_t[nBufSize];
-nBufSize = mpFontData->GetFontTable("hhea", pHheaBuf);
-std::vector rHhea(pHheaBuf, pHheaBuf + nBufSize);
-
-nBufSize = mpFontData->GetFontTable("OS/2", nullptr);
-uint8_t* pOS2Buf = new uint8_t[nBufSize];
-nBufSize = mpFontData->GetFontTable("OS/2", pOS2Buf);
-std::vector rOS2(pOS2Buf, pOS2Buf + nBufSize);
-
-rxFontMetric->ImplCalcLineSpacing(rHhea, rOS2, 
CTFontGetUnitsPerEm(aCTFontRef));
-
-delete[] pHheaBuf;
-delete[] pOS2Buf;
+rxFontMetric->ImplCalcLineSpacing(this);
 
 // since 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - download.lst external/harfbuzz

2021-03-24 Thread Khaled Hosny (via logerrit)
 download.lst  |4 ++--
 external/harfbuzz/ExternalProject_harfbuzz.mk |1 -
 external/harfbuzz/UnpackedTarball_harfbuzz.mk |4 
 external/harfbuzz/msvc.patch  |   17 -
 4 files changed, 2 insertions(+), 24 deletions(-)

New commits:
commit c3a4248a4e82b576cf169c1de22cdc85bc754439
Author: Khaled Hosny 
AuthorDate: Tue Aug 20 10:33:40 2019 +0200
Commit: Aron Budea 
CommitDate: Wed Mar 24 16:19:02 2021 +0100

Update HarfBbuzz to 2.6.0

Reviewed-on: https://gerrit.libreoffice.org/77790
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 
(cherry picked from commit 352924a64750bb99aec54feea3af0121603c12a8)

Change-Id: I7983dd10fe6599a2473caf0da04a0df3e63e9b2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112482
Tested-by: Aron Budea 
Reviewed-by: Aron Budea 

diff --git a/download.lst b/download.lst
index 389a98716bc3..7906d0e16800 100644
--- a/download.lst
+++ b/download.lst
@@ -118,8 +118,8 @@ export GPGME_SHA256SUM := 
1b29fedb8bfad775e70eafac5b0590621683b2d9869db994568e64
 export GPGME_TARBALL := gpgme-1.9.0.tar.bz2
 export GRAPHITE_SHA256SUM := 
aa5e58356cd084000609ebbd93fef456a1bc0ab9e46fea20e81552fb286232a9
 export GRAPHITE_TARBALL := graphite2-minimal-1.3.10.tgz
-export HARFBUZZ_SHA256SUM := 
f205699d5b91374008d6f8e36c59e419ae2d9a7bb8c5d9f34041b9a5abcae468
-export HARFBUZZ_TARBALL := harfbuzz-2.3.1.tar.bz2
+export HARFBUZZ_SHA256SUM := 
9cf7d117548265f95ca884e2f4c9fafaf4e17d45a67b11107147b79eed76c966
+export HARFBUZZ_TARBALL := harfbuzz-2.6.0.tar.xz
 export HSQLDB_SHA256SUM := 
d30b13f4ba2e3b6a2d4f020c0dee0a9fb9fc6fbcc2d561f36b78da4bf3802370
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
 export HUNSPELL_SHA256SUM := 
57be4e03ae9dd62c3471f667a0d81a14513e314d4d92081292b90435944ff951
diff --git a/external/harfbuzz/ExternalProject_harfbuzz.mk 
b/external/harfbuzz/ExternalProject_harfbuzz.mk
index ad5c187ba4c5..98de3e161e54 100644
--- a/external/harfbuzz/ExternalProject_harfbuzz.mk
+++ b/external/harfbuzz/ExternalProject_harfbuzz.mk
@@ -36,7 +36,6 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) :
--with-fontconfig=no \
--with-cairo=no \
--with-glib=no \
-   --with-ucdn=no \
--with-graphite2=yes \
$(if $(filter iOS MACOSX,$(OS)),--with-coretext=yes) \
$(if 
$(verbose),--disable-silent-rules,--enable-silent-rules) \
diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk 
b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index 48d7b450bc3a..a99f116d80ad 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -15,8 +15,4 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,harfbuzz))
 
 $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
 
-$(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
-external/harfbuzz/msvc.patch \
-))
-
 # vim: set noet sw=4 ts=4:
diff --git a/external/harfbuzz/msvc.patch b/external/harfbuzz/msvc.patch
deleted file mode 100644
index f6796a99bf8e..
--- a/external/harfbuzz/msvc.patch
+++ /dev/null
@@ -1,17 +0,0 @@
 src/hb-atomic.hh
-+++ src/hb-atomic.hh
-@@ -85,11 +85,11 @@
- #define hb_atomic_int_impl_add(AI, V) 
(reinterpret_cast *> (AI)->fetch_add ((V), 
std::memory_order_acq_rel))
- #define hb_atomic_int_impl_set_relaxed(AI, V) 
(reinterpret_cast *> (AI)->store ((V), 
std::memory_order_relaxed))
- #define hb_atomic_int_impl_set(AI, V) 
(reinterpret_cast *> (AI)->store ((V), 
std::memory_order_release))
--#define hb_atomic_int_impl_get_relaxed(AI)
(reinterpret_cast *> (AI)->load (std::memory_order_relaxed))
--#define hb_atomic_int_impl_get(AI)
(reinterpret_cast *> (AI)->load (std::memory_order_acquire))
-+#define hb_atomic_int_impl_get_relaxed(AI)
(reinterpret_cast const *> (AI)->load 
(std::memory_order_relaxed))
-+#define hb_atomic_int_impl_get(AI)
(reinterpret_cast const *> (AI)->load 
(std::memory_order_acquire))
- 
- #define hb_atomic_ptr_impl_set_relaxed(P, V)  
(reinterpret_cast *> (P)->store ((V), 
std::memory_order_relaxed))
--#define hb_atomic_ptr_impl_get_relaxed(P) 
(reinterpret_cast *> (P)->load (std::memory_order_relaxed))
-+#define hb_atomic_ptr_impl_get_relaxed(P) 
(reinterpret_cast const *> (P)->load 
(std::memory_order_relaxed))
- #define hb_atomic_ptr_impl_get(P) 
(reinterpret_cast *> (P)->load (std::memory_order_acquire))
- static inline bool
- _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/source vcl/unx

2020-11-30 Thread Khaled Hosny (via logerrit)
 vcl/source/font/fontmetric.cxx |4 -
 vcl/source/fontsubset/sft.cxx  |5 +-
 vcl/unx/generic/fontmanager/fontconfig.cxx |   51 -
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |6 +-
 4 files changed, 34 insertions(+), 32 deletions(-)

New commits:
commit 2bd4f2d375b7b915ec17f17f30e36b2a8aa50a4a
Author: Khaled Hosny 
AuthorDate: Tue Aug 27 15:19:15 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Mon Nov 30 09:47:21 2020 +0100

Make Noto Color Emoji font work on Linux

Noto Color Emoji is a bitmap color font, Cairo knows how to scale such
fonts and FontConfig will identify them as scalable but not outline
fonts, so change the FontConfig checks to checks for scalability.

Make sft.cxx:doOpenTTFont() accept non-outline fonts, the text will not
show in PDF but that is not worse than the status quo.

Change-Id: I756c718296d2c43e3165cd2f07b11bbb981318d3
Reviewed-on: https://gerrit.libreoffice.org/78218
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106836
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 
Reviewed-by: Tor Lillqvist 

diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 5a108ca26f47..4dd3cf88abcd 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -484,8 +484,8 @@ void ImplFontMetricData::ImplCalcLineSpacing(const 
std::vector& rHheaDa
 if (mnAscent || mnDescent)
 mnIntLeading = mnAscent + mnDescent - mnHeight;
 
-SAL_INFO("vcl.gdi.fontmetric",
-  "fsSelection: "   << rInfo.fsSelection
+SAL_INFO("vcl.gdi.fontmetric", GetFamilyName()
+ << ": fsSelection: "   << rInfo.fsSelection
  << ", typoAscender: "  << rInfo.typoAscender
  << ", typoDescender: " << rInfo.typoDescender
  << ", typoLineGap: "   << rInfo.typoLineGap
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 9262c2bca365..802453ae7446 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1661,7 +1661,10 @@ static SFErrCodes doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 /* TODO: implement to get subsetting */
 assert(t->goffsets != nullptr);
 } else {
-return SFErrCodes::TtFormat;
+// Bitmap font, accept for now.
+t->goffsets = static_cast(calloc(1+t->nglyphs, 
sizeof(sal_uInt32)));
+/* TODO: implement to get subsetting */
+assert(t->goffsets != nullptr);
 }
 
 table = getTable(t, O_hhea);
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 7205ef386668..ffd36c62f7bb 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -65,7 +65,7 @@ namespace
 
 class FontCfgWrapper
 {
-FcFontSet* m_pOutlineSet;
+FcFontSet* m_pFontSet;
 
 void addFontSet( FcSetName );
 
@@ -93,17 +93,14 @@ private:
 };
 
 FontCfgWrapper::FontCfgWrapper()
-: m_pOutlineSet( nullptr )
+: m_pFontSet( nullptr )
 {
 FcInit();
 }
 
 void FontCfgWrapper::addFontSet( FcSetName eSetName )
 {
-/*
-  add only acceptable outlined fonts to our config,
-  for future fontconfig use
-*/
+// Add only acceptable fonts to our config, for future fontconfig use.
 FcFontSet* pOrig = FcConfigGetFonts( FcConfigGetCurrent(), eSetName );
 if( !pOrig )
 return;
@@ -112,10 +109,12 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
 for( int i = 0; i < pOrig->nfont; ++i )
 {
 FcPattern* pPattern = pOrig->fonts[i];
-// #i115131# ignore non-outline fonts
-FcBool bOutline = FcFalse;
-FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, 
 );
-if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
+// #i115131# ignore non-scalable fonts
+// Scalable fonts are usually outline fonts, but some bitmaps fonts
+// (like Noto Color Emoji) are also scalable.
+FcBool bScalable = FcFalse;
+FcResult eScalableRes = FcPatternGetBool(pPattern, FC_SCALABLE, 0, 
);
+if ((eScalableRes != FcResultMatch) || (bScalable == FcFalse))
 continue;
 
 // Ignore Type 1 fonts, too.
@@ -125,7 +124,7 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
 continue;
 
 FcPatternReference( pPattern );
-FcFontSetAdd( m_pOutlineSet, pPattern );
+FcFontSetAdd( m_pFontSet, pPattern );
 }
 
 // TODO?: FcFontSetDestroy( pOrig );
@@ -216,16 +215,16 @@ namespace
 
 FcFontSet* FontCfgWrapper::getFontSet()
 {
-if( !m_pOutlineSet )
+if( !m_pFontSet )
 {
-m_pOutlineSet = FcFontSetCreate();
+m_pFontSet = FcFontSetCreate();
 addFontSet( FcSetSystem );
 addFontSet( FcSetApplication );
 

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

2019-09-22 Thread Khaled Hosny (via logerrit)
 vcl/inc/fontinstance.hxx |2 -
 vcl/source/font/fontinstance.cxx |   43 +--
 2 files changed, 3 insertions(+), 42 deletions(-)

New commits:
commit 4ce644feaa732e9f306e6c53300e024ac2a11bb7
Author: Khaled Hosny 
AuthorDate: Sat Sep 21 23:12:49 2019 +0200
Commit: Khaled Hosny 
CommitDate: Sun Sep 22 07:34:44 2019 +0200

tdf#127325: Revert "Use HarfBuzz to get glyph bounding rectangle"

This reverts commit 502d73cda8fa1f482634bb6435fd1440757fdad9.

Change-Id: Ib1a318e6d9a722f9ca056ba1df3a6f2ab19855e5
Reviewed-on: https://gerrit.libreoffice.org/79323
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index b57955f82a9e..da5af02b1089 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -71,7 +71,7 @@ public: // TODO: make data members private
 const PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); }
 const ImplFontCache* GetFontCache() const { return mpFontCache; }
 
-bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool);
+bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const;
 virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) 
const = 0;
 
 int GetKashidaWidth();
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 808f2d0a5c27..58d72083f130 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -144,51 +144,12 @@ void LogicalFontInstance::IgnoreFallbackForUnicode( 
sal_UCS4 cChar, FontWeight e
 mpUnicodeFallbackList->erase( it );
 }
 
-bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle 
, bool bVertical)
+bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle 
, bool bVertical) const
 {
 if (mpFontCache && mpFontCache->GetCachedGlyphBoundRect(this, nID, rRect))
 return true;
 
-hb_font_t* pHbFont = GetHbFont();
-hb_glyph_extents_t aExtents;
-bool res = hb_font_get_glyph_extents(pHbFont, nID, );
-if (res)
-{
-double nXScale = 0, nYScale = 0;
-GetScale(, );
-
-double fMinX = aExtents.x_bearing;
-double fMinY = aExtents.y_bearing;
-double fMaxX = aExtents.x_bearing + aExtents.width;
-double fMaxY = aExtents.y_bearing + aExtents.height;
-
-tools::Rectangle aRect( std::floor(fMinX * nXScale),
-   -std::ceil(fMinY  * nYScale),
-std::ceil(fMaxX  * nXScale),
-   -std::floor(fMaxY * nYScale));
-
-if (mnOrientation && !bVertical)
-{
-// Apply font rotation.
-const double fRad = basegfx::deg2rad(mnOrientation);
-const double fCos = cos(fRad);
-const double fSin = sin(fRad);
-
-rRect.SetLeft(   fCos * aRect.Left() + fSin * aRect.Top());
-rRect.SetTop(   -fSin * aRect.Left() - fCos * aRect.Top());
-rRect.SetRight(  fCos * aRect.Right() + fSin * aRect.Bottom());
-rRect.SetBottom(-fSin * aRect.Right() - fCos * aRect.Bottom());
-}
-else
-rRect = aRect;
-}
-else
-{
-// Fallback to platform implementations.
-// TODO: remove once we require HarfBuzz >= 2.3.0
-res = ImplGetGlyphBoundRect(nID, rRect, bVertical);
-}
-
+bool res = ImplGetGlyphBoundRect(nID, rRect, bVertical);
 if (mpFontCache && res)
 mpFontCache->CacheGlyphBoundRect(this, nID, rRect);
 return res;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'private/khaledhosny/vcl-cleanup-font' - 148 commits - accessibility/source android/README android/source basctl/source basic/source bean/com bin/check-elf-dynam

2019-09-11 Thread Khaled Hosny (via logerrit)
Rebased ref, commits from common ancestor:
commit ac9d7d4157813fcf43dd41043981c4bb27d2cc33
Author: Khaled Hosny 
AuthorDate: Tue Sep 3 14:40:42 2019 +0200
Commit: Khaled Hosny 
CommitDate: Wed Sep 11 12:40:33 2019 +0200

Consolidate GetFontCapabilities()

All implementations were basically doing the same thing. Move to
PhysicalFontFace and use HarfBuzz API to get the raw OpeenType table
data.

Change-Id: Ia5ac0d1ba6299f86e90e1b0dac34ba7672855ec0

diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx
index 3992bb91bf41..679420a05fd1 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/PhysicalFontFace.hxx
@@ -22,6 +22,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -70,6 +71,7 @@ public:
 sal_Int32   CompareIgnoreSize( const PhysicalFontFace& ) const;
 
 const FontCharMapRef&   GetCharMap() const;
+boolGetCapabilities(vcl::FontCapabilities 
) const;
 
 hb_face_t*  GetHbFace() const;
 virtual hb_blob_t*  GetHbTable(hb_tag_t nTag) const = 0;
@@ -84,6 +86,8 @@ protected:
 mutable hb_face_t*  mpHbFace;
 
 mutable FontCharMapRef  mxCharMap;
+mutable boolmbCapabilitiesRead;
+mutable vcl::FontCapabilities maCapabilities;
 };
 
 #endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
diff --git a/vcl/inc/qt5/Qt5FontFace.hxx b/vcl/inc/qt5/Qt5FontFace.hxx
index a179438cf2a5..03884fc31df9 100644
--- a/vcl/inc/qt5/Qt5FontFace.hxx
+++ b/vcl/inc/qt5/Qt5FontFace.hxx
@@ -42,8 +42,6 @@ public:
 
 int GetFontTable(const char pTagName[5], unsigned char*) const;
 
-bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const;
-
 rtl::Reference
 CreateFontInstance(const FontSelectPattern& rFSD) const override;
 
@@ -55,8 +53,6 @@ protected:
 
 private:
 const QString m_aFontId;
-mutable vcl::FontCapabilities m_aFontCapabilities;
-mutable bool m_bFontCapabilitiesRead;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 3be470f0caf6..540d695a3a11 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -67,16 +67,12 @@ public:
 int GetFontTable( uint32_t nTagCode, unsigned 
char* ) const;
 int GetFontTable( const char pTagName[5], 
unsigned char* ) const;
 
-boolGetFontCapabilities(vcl::FontCapabilities 
) const;
-
 rtl::Reference CreateFontInstance(const 
FontSelectPattern&) const override;
 
 hb_blob_t*  GetHbTable(hb_tag_t nTag) const override;
 
 private:
 const sal_IntPtrmnFontId;
-mutable vcl::FontCapabilities   maFontCapabilities;
-mutable boolmbFontCapabilitiesRead;
 };
 
 class CoreTextStyle final : public LogicalFontInstance
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index c072752db6a7..12800ae0458c 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -107,7 +107,6 @@ public:
 
 voidGetFontMetric(ImplFontMetricDataRef const &) const;
 const unsigned char*GetTable( const char* pName, sal_uLong* pLength ) 
const;
-boolGetFontCapabilities(vcl::FontCapabilities &) const;
 
 boolGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, 
bool) const;
 boolGetGlyphOutline(sal_GlyphId, 
basegfx::B2DPolyPolygon&, bool) const;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 0cc2fd05ba2d..5eeb0747c253 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -71,24 +71,16 @@ public:
 BYTEGetCharSet() const  { return meWinCharSet; 
}
 BYTEGetPitchAndFamily() const   { return 
mnPitchAndFamily; }
 
-bool GetFontCapabilities(vcl::FontCapabilities ) const;
-
 hb_blob_t*  GetHbTable(hb_tag_t nTag) const override;
 
 private:
 sal_IntPtr  mnId;
 
-// some members that are initialized lazily when the font gets selected 
into a HDC
-mutable boolmbFontCapabilitiesRead;
-mutable vcl::FontCapabilities   maFontCapabilities;
-
 BYTEmeWinCharSet;
 BYTEmnPitchAndFamily;
 boolmbAliasSymbolsHigh;
 boolmbAliasSymbolsLow;
 
-voidGetFontCapabilities( HDC hDC ) const;
-
 mutable HDC mhDC;
 };
 
diff --git a/vcl/qt5/Qt5FontFace.cxx b/vcl/qt5/Qt5FontFace.cxx
index 4c4bbb7ef6de..dcf7cbf6611c 100644
--- a/vcl/qt5/Qt5FontFace.cxx
+++ b/vcl/qt5/Qt5FontFace.cxx
@@ -128,7 +128,6 @@ Qt5FontFace* Qt5FontFace::fromQFontDatabase(const QString& 
aFamily, const QStrin
 Qt5FontFace::Qt5FontFace(const FontAttributes& rFA, const QString& rFontID)
 : PhysicalFontFace(rFA)
 , 

[Libreoffice-commits] core.git: 2 commits - vcl/inc vcl/unx

2019-09-05 Thread Khaled Hosny (via logerrit)
 vcl/inc/unx/freetype_glyphcache.hxx|1 
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |   59 ++---
 2 files changed, 5 insertions(+), 55 deletions(-)

New commits:
commit 467387ed2f4f226b580da7a674c2ed88365c976a
Author: Khaled Hosny 
AuthorDate: Wed Aug 28 12:50:22 2019 +0200
Commit: Khaled Hosny 
CommitDate: Thu Sep 5 19:24:10 2019 +0200

Merge GetFontCodeRanges() into GetFontCharMap()

Change-Id: I61d8edf0be492c1c06274c11ac5d2e65415525a9
Reviewed-on: https://gerrit.libreoffice.org/78638
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/inc/unx/freetype_glyphcache.hxx 
b/vcl/inc/unx/freetype_glyphcache.hxx
index 6fd0154d98a7..17084fcf5a75 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -75,7 +75,6 @@ public:
 
 void  AnnounceFont( PhysicalFontCollection* );
 
-bool  GetFontCodeRanges( CmapResult& ) const;
 const FontCharMapRef& GetFontCharMap();
 
 private:
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx 
b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index ed473e9c198a..d58c5bedc097 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -704,8 +704,11 @@ const FontCharMapRef& FreetypeFontInfo::GetFontCharMap()
 
 // get the charmap and cache it
 CmapResult aCmapResult;
-bool bOK = GetFontCodeRanges( aCmapResult );
-if( bOK )
+aCmapResult.mbSymbolic = IsSymbolFont();
+
+sal_uLong nLength = 0;
+const unsigned char* pCmap = GetTable("cmap", );
+if (pCmap && (nLength > 0) && ParseCMAP(pCmap, nLength, aCmapResult))
 {
 FontCharMapRef xFontCharMap( new FontCharMap ( aCmapResult ) );
 mxFontCharMap = xFontCharMap;
@@ -719,19 +722,6 @@ const FontCharMapRef& FreetypeFontInfo::GetFontCharMap()
 return mxFontCharMap;
 }
 
-// TODO: merge into method GetFontCharMap()
-bool FreetypeFontInfo::GetFontCodeRanges( CmapResult& rResult ) const
-{
-rResult.mbSymbolic = IsSymbolFont();
-
-sal_uLong nLength = 0;
-const unsigned char* pCmap = GetTable( "cmap",  );
-if( pCmap && (nLength > 0) )
-if( ParseCMAP( pCmap, nLength, rResult ) )
-return true;
-return false;
-}
-
 bool FreetypeFont::GetFontCapabilities(vcl::FontCapabilities 
) const
 {
 bool bRet = false;
commit fc0119d0afb7775663762d972b6d5dbc15581c66
Author: Khaled Hosny 
AuthorDate: Wed Aug 28 12:46:19 2019 +0200
Commit: Khaled Hosny 
CommitDate: Thu Sep 5 19:24:01 2019 +0200

Remove effectively dead code

We dropped support for non-SFNT fonts for a while now.

Change-Id: Iaa2ea308effa7328bd84240cf29fc3fd117d418a
Reviewed-on: https://gerrit.libreoffice.org/78637
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx 
b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 525da6e52b43..ed473e9c198a 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -465,9 +465,6 @@ FreetypeFont::FreetypeFont(LogicalFontInstance* 
pFontInstance, FreetypeFontInfo*
 if( mpFontInfo->IsSymbolFont() )
 {
 FT_Encoding eEncoding = FT_ENCODING_MS_SYMBOL;
-if (!FT_IS_SFNT(maFaceFT))
-eEncoding = FT_ENCODING_ADOBE_CUSTOM; // freetype wants this for 
PS symbol fonts
-
 FT_Select_Charmap(maFaceFT, eEncoding);
 }
 
@@ -727,48 +724,12 @@ bool FreetypeFontInfo::GetFontCodeRanges( CmapResult& 
rResult ) const
 {
 rResult.mbSymbolic = IsSymbolFont();
 
-// TODO: is the full CmapResult needed on platforms calling this?
-if( FT_IS_SFNT( maFaceFT ) )
-{
-sal_uLong nLength = 0;
-const unsigned char* pCmap = GetTable( "cmap",  );
-if( pCmap && (nLength > 0) )
-if( ParseCMAP( pCmap, nLength, rResult ) )
-return true;
-}
-
-std::vector aCodes;
-
-// FT's coverage is available since FT>=2.1.0 (OOo-baseline>=2.1.4 => ok)
-aCodes.reserve( 0x1000 );
-FT_UInt nGlyphIndex;
-for( sal_uInt32 cCode = FT_Get_First_Char( maFaceFT,  );; )
-{
-if( !nGlyphIndex )
-break;
-aCodes.push_back( cCode );  // first code inside range
-sal_uInt32 cNext;
-do cNext = FT_Get_Next_Char( maFaceFT, cCode,  ); while( 
cNext == ++cCode );
-aCodes.push_back( cCode );  // first code outside range
-cCode = cNext;
-}
-
-const int nCount = aCodes.size();
-if( !nCount) {
-if( !rResult.mbSymbolic )
-return false;
-
-// we usually get here for Type1 symbol fonts
-aCodes.push_back( 0xF020 );
-aCodes.push_back( 0xF100 );
-}
-
-sal_uInt32* pCodes = new sal_uInt32[ nCount ];
-for( int i = 0; i < nCount; ++i )
-pCodes[i] = aCodes[i];
-rResult.mpRangeCodes = pCodes;
-

[Libreoffice-commits] core.git: Branch 'private/khaledhosny/vcl-cleanup-font' - 4 commits - vcl/headless vcl/inc vcl/Library_vcl.mk vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win

2019-09-05 Thread Khaled Hosny (via logerrit)
Rebased ref, commits from common ancestor:
commit d07cc605823279a3fbf77a4948a55a7509743ddb
Author: Khaled Hosny 
AuthorDate: Tue Sep 3 14:40:42 2019 +0200
Commit: Khaled Hosny 
CommitDate: Thu Sep 5 11:15:11 2019 +0200

Consolidate GetFontCapabilities()

All implementations were basically doing the same thing. Move to
PhysicalFontFace and use HarfBuzz API to get the raw OpeenType table
data.

Change-Id: Ia5ac0d1ba6299f86e90e1b0dac34ba7672855ec0

diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx
index 35cbf923665d..944ecceee303 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/PhysicalFontFace.hxx
@@ -22,6 +22,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -70,6 +71,7 @@ public:
 sal_Int32   CompareIgnoreSize( const PhysicalFontFace& ) const;
 
 const FontCharMapRef&   GetCharMap() const;
+boolGetCapabilities(vcl::FontCapabilities 
) const;
 
 hb_face_t*  GetHbFace() const { return mpHbFace; }
 virtual hb_blob_t*  GetHbTable(const char* pName) = 0;
@@ -84,6 +86,8 @@ protected:
 hb_face_t*  mpHbFace;
 
 mutable FontCharMapRef  mxCharMap;
+mutable boolmbCapabilitiesRead;
+mutable vcl::FontCapabilities maCapabilities;
 };
 
 #endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
diff --git a/vcl/inc/qt5/Qt5FontFace.hxx b/vcl/inc/qt5/Qt5FontFace.hxx
index 14da580393d8..d57e5e450977 100644
--- a/vcl/inc/qt5/Qt5FontFace.hxx
+++ b/vcl/inc/qt5/Qt5FontFace.hxx
@@ -42,8 +42,6 @@ public:
 
 int GetFontTable(const char pTagName[5], unsigned char*) const;
 
-bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const;
-
 rtl::Reference
 CreateFontInstance(const FontSelectPattern& rFSD) const override;
 
@@ -55,8 +53,6 @@ protected:
 
 private:
 const QString m_aFontId;
-mutable vcl::FontCapabilities m_aFontCapabilities;
-mutable bool m_bFontCapabilitiesRead;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index fa4e6e780a47..540a4acd2d9f 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -67,16 +67,12 @@ public:
 int GetFontTable( uint32_t nTagCode, unsigned 
char* ) const;
 int GetFontTable( const char pTagName[5], 
unsigned char* ) const;
 
-boolGetFontCapabilities(vcl::FontCapabilities 
) const;
-
 rtl::Reference CreateFontInstance(const 
FontSelectPattern&) const override;
 
 hb_blob_t*  GetHbTable(const char* pName) override;
 
 private:
 const sal_IntPtrmnFontId;
-mutable vcl::FontCapabilities   maFontCapabilities;
-mutable boolmbFontCapabilitiesRead;
 };
 
 class CoreTextStyle final : public LogicalFontInstance
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index 77565b3e04b9..4f2ac3ab5805 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -107,7 +107,6 @@ public:
 
 voidGetFontMetric(ImplFontMetricDataRef const &) const;
 const unsigned char*GetTable( const char* pName, sal_uLong* pLength ) 
const;
-boolGetFontCapabilities(vcl::FontCapabilities &) const;
 
 boolGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, 
bool) const;
 boolGetGlyphOutline(sal_GlyphId, 
basegfx::B2DPolyPolygon&, bool) const;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 5048e022aa72..c8a6a457b973 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -71,24 +71,16 @@ public:
 BYTEGetCharSet() const  { return meWinCharSet; 
}
 BYTEGetPitchAndFamily() const   { return 
mnPitchAndFamily; }
 
-bool GetFontCapabilities(vcl::FontCapabilities ) const;
-
 hb_blob_t*  GetHbTable(const char* pName) override;
 
 private:
 sal_IntPtr  mnId;
 
-// some members that are initialized lazily when the font gets selected 
into a HDC
-mutable boolmbFontCapabilitiesRead;
-mutable vcl::FontCapabilities   maFontCapabilities;
-
 BYTEmeWinCharSet;
 BYTEmnPitchAndFamily;
 boolmbAliasSymbolsHigh;
 boolmbAliasSymbolsLow;
 
-voidGetFontCapabilities( HDC hDC ) const;
-
 mutable HDC mhDC;
 };
 
diff --git a/vcl/qt5/Qt5FontFace.cxx b/vcl/qt5/Qt5FontFace.cxx
index 5e8f9c30d9bf..5d91f2f2a2e8 100644
--- a/vcl/qt5/Qt5FontFace.cxx
+++ b/vcl/qt5/Qt5FontFace.cxx
@@ -128,7 +128,6 @@ Qt5FontFace* Qt5FontFace::fromQFontDatabase(const QString& 
aFamily, const QStrin
 Qt5FontFace::Qt5FontFace(const FontAttributes& rFA, const QString& rFontID)
 : PhysicalFontFace(rFA)
 

[Libreoffice-commits] core.git: Branch 'private/khaledhosny/vcl-cleanup-font' - 8 commits - offapi/com vcl/headless vcl/inc vcl/Library_vcl.mk vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win

2019-09-05 Thread Khaled Hosny (via logerrit)
Rebased ref, commits from common ancestor:
commit d4c2b51514616751a6f8e07bbc66b0bb93049121
Author: Khaled Hosny 
AuthorDate: Tue Sep 3 14:40:42 2019 +0200
Commit: Khaled Hosny 
CommitDate: Thu Sep 5 11:00:16 2019 +0200

Consolidate GetFontCapabilities()

All implementations were basically doing the same thing. Move to
PhysicalFontFace and use HarfBuzz API to get the raw OpeenType table
data.

Change-Id: Ia5ac0d1ba6299f86e90e1b0dac34ba7672855ec0

diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx
index 35cbf923665d..944ecceee303 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/PhysicalFontFace.hxx
@@ -22,6 +22,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -70,6 +71,7 @@ public:
 sal_Int32   CompareIgnoreSize( const PhysicalFontFace& ) const;
 
 const FontCharMapRef&   GetCharMap() const;
+boolGetCapabilities(vcl::FontCapabilities 
) const;
 
 hb_face_t*  GetHbFace() const { return mpHbFace; }
 virtual hb_blob_t*  GetHbTable(const char* pName) = 0;
@@ -84,6 +86,8 @@ protected:
 hb_face_t*  mpHbFace;
 
 mutable FontCharMapRef  mxCharMap;
+mutable boolmbCapabilitiesRead;
+mutable vcl::FontCapabilities maCapabilities;
 };
 
 #endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
diff --git a/vcl/inc/qt5/Qt5FontFace.hxx b/vcl/inc/qt5/Qt5FontFace.hxx
index 14da580393d8..d57e5e450977 100644
--- a/vcl/inc/qt5/Qt5FontFace.hxx
+++ b/vcl/inc/qt5/Qt5FontFace.hxx
@@ -42,8 +42,6 @@ public:
 
 int GetFontTable(const char pTagName[5], unsigned char*) const;
 
-bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const;
-
 rtl::Reference
 CreateFontInstance(const FontSelectPattern& rFSD) const override;
 
@@ -55,8 +53,6 @@ protected:
 
 private:
 const QString m_aFontId;
-mutable vcl::FontCapabilities m_aFontCapabilities;
-mutable bool m_bFontCapabilitiesRead;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index fa4e6e780a47..540a4acd2d9f 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -67,16 +67,12 @@ public:
 int GetFontTable( uint32_t nTagCode, unsigned 
char* ) const;
 int GetFontTable( const char pTagName[5], 
unsigned char* ) const;
 
-boolGetFontCapabilities(vcl::FontCapabilities 
) const;
-
 rtl::Reference CreateFontInstance(const 
FontSelectPattern&) const override;
 
 hb_blob_t*  GetHbTable(const char* pName) override;
 
 private:
 const sal_IntPtrmnFontId;
-mutable vcl::FontCapabilities   maFontCapabilities;
-mutable boolmbFontCapabilitiesRead;
 };
 
 class CoreTextStyle final : public LogicalFontInstance
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index 77565b3e04b9..4f2ac3ab5805 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -107,7 +107,6 @@ public:
 
 voidGetFontMetric(ImplFontMetricDataRef const &) const;
 const unsigned char*GetTable( const char* pName, sal_uLong* pLength ) 
const;
-boolGetFontCapabilities(vcl::FontCapabilities &) const;
 
 boolGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, 
bool) const;
 boolGetGlyphOutline(sal_GlyphId, 
basegfx::B2DPolyPolygon&, bool) const;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index fb2f4deac56d..04dcc4738db8 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -71,24 +71,16 @@ public:
 BYTEGetCharSet() const  { return meWinCharSet; 
}
 BYTEGetPitchAndFamily() const   { return 
mnPitchAndFamily; }
 
-bool GetFontCapabilities(vcl::FontCapabilities ) const;
-
 hb_blob_t*  GetHbTable(const char* pName) override;
 
 private:
 sal_IntPtr  mnId;
 
-// some members that are initialized lazily when the font gets selected 
into a HDC
-mutable boolmbFontCapabilitiesRead;
-mutable vcl::FontCapabilities   maFontCapabilities;
-
 BYTEmeWinCharSet;
 BYTEmnPitchAndFamily;
 boolmbAliasSymbolsHigh;
 boolmbAliasSymbolsLow;
 
-voidGetFontCapabilities( HDC hDC ) const;
-
 HDC mhDC;
 };
 
diff --git a/vcl/qt5/Qt5FontFace.cxx b/vcl/qt5/Qt5FontFace.cxx
index 5e8f9c30d9bf..5d91f2f2a2e8 100644
--- a/vcl/qt5/Qt5FontFace.cxx
+++ b/vcl/qt5/Qt5FontFace.cxx
@@ -128,7 +128,6 @@ Qt5FontFace* Qt5FontFace::fromQFontDatabase(const QString& 
aFamily, const QStrin
 Qt5FontFace::Qt5FontFace(const FontAttributes& rFA, const QString& rFontID)
 : PhysicalFontFace(rFA)
 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/source vcl/unx

2019-09-04 Thread Khaled Hosny (via logerrit)
 vcl/source/font/fontmetric.cxx |4 -
 vcl/source/fontsubset/sft.cxx  |5 +-
 vcl/unx/generic/fontmanager/fontconfig.cxx |   51 -
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |6 +-
 4 files changed, 34 insertions(+), 32 deletions(-)

New commits:
commit 1fc306203b047e79d5b3f30cf615609f80b62fe4
Author: Khaled Hosny 
AuthorDate: Tue Aug 27 15:19:15 2019 +0200
Commit: Caolán McNamara 
CommitDate: Wed Sep 4 16:03:55 2019 +0200

Make Noto Color Emoji font work on Linux

Noto Color Emoji is a bitmap color font, Cairo knows how to scale such
fonts and FontConfig will identify them as scalable but not outline
fonts, so change the FontConfig checks to checks for scalability.

Make sft.cxx:doOpenTTFont() accept non-outline fonts, the text will not
show in PDF but that is not worse than the status quo.

Change-Id: I756c718296d2c43e3165cd2f07b11bbb981318d3
Reviewed-on: https://gerrit.libreoffice.org/78218
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 
(cherry picked from commit dcf7792da2aa2a1ef774a124f7b21f68fff0fd15)
Reviewed-on: https://gerrit.libreoffice.org/78589

diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 4e6c648be3c7..a9325fde9a21 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -485,8 +485,8 @@ void ImplFontMetricData::ImplCalcLineSpacing(const 
std::vector& rHheaDa
 if (mnAscent || mnDescent)
 mnIntLeading = mnAscent + mnDescent - mnHeight;
 
-SAL_INFO("vcl.gdi.fontmetric",
-  "fsSelection: "   << rInfo.fsSelection
+SAL_INFO("vcl.gdi.fontmetric", GetFamilyName()
+ << ": fsSelection: "   << rInfo.fsSelection
  << ", typoAscender: "  << rInfo.typoAscender
  << ", typoDescender: " << rInfo.typoDescender
  << ", typoLineGap: "   << rInfo.typoLineGap
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 2ad41691f1ef..979783a5021a 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1668,7 +1668,10 @@ static SFErrCodes doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 /* TODO: implement to get subsetting */
 assert(t->goffsets != nullptr);
 } else {
-return SFErrCodes::TtFormat;
+// Bitmap font, accept for now.
+t->goffsets = static_cast(calloc(1+t->nglyphs, 
sizeof(sal_uInt32)));
+/* TODO: implement to get subsetting */
+assert(t->goffsets != nullptr);
 }
 
 table = getTable(t, O_hhea);
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index e13eb0a82716..8e3e9163d1ce 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -65,7 +65,7 @@ namespace
 
 class FontCfgWrapper
 {
-FcFontSet* m_pOutlineSet;
+FcFontSet* m_pFontSet;
 
 void addFontSet( FcSetName );
 
@@ -93,17 +93,14 @@ private:
 };
 
 FontCfgWrapper::FontCfgWrapper()
-: m_pOutlineSet( nullptr )
+: m_pFontSet( nullptr )
 {
 FcInit();
 }
 
 void FontCfgWrapper::addFontSet( FcSetName eSetName )
 {
-/*
-  add only acceptable outlined fonts to our config,
-  for future fontconfig use
-*/
+// Add only acceptable fonts to our config, for future fontconfig use.
 FcFontSet* pOrig = FcConfigGetFonts( FcConfigGetCurrent(), eSetName );
 if( !pOrig )
 return;
@@ -112,10 +109,12 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
 for( int i = 0; i < pOrig->nfont; ++i )
 {
 FcPattern* pPattern = pOrig->fonts[i];
-// #i115131# ignore non-outline fonts
-FcBool bOutline = FcFalse;
-FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, 
 );
-if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
+// #i115131# ignore non-scalable fonts
+// Scalable fonts are usually outline fonts, but some bitmaps fonts
+// (like Noto Color Emoji) are also scalable.
+FcBool bScalable = FcFalse;
+FcResult eScalableRes = FcPatternGetBool(pPattern, FC_SCALABLE, 0, 
);
+if ((eScalableRes != FcResultMatch) || (bScalable == FcFalse))
 continue;
 
 // Ignore Type 1 fonts, too.
@@ -125,7 +124,7 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
 continue;
 
 FcPatternReference( pPattern );
-FcFontSetAdd( m_pOutlineSet, pPattern );
+FcFontSetAdd( m_pFontSet, pPattern );
 }
 
 // TODO?: FcFontSetDestroy( pOrig );
@@ -216,16 +215,16 @@ namespace
 
 FcFontSet* FontCfgWrapper::getFontSet()
 {
-if( !m_pOutlineSet )
+if( !m_pFontSet )
 {
-m_pOutlineSet = FcFontSetCreate();
+m_pFontSet = FcFontSetCreate();
 addFontSet( FcSetSystem );
 addFontSet( FcSetApplication );
 
-

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

2019-09-03 Thread Khaled Hosny (via logerrit)
 vcl/source/font/fontmetric.cxx |4 -
 vcl/source/fontsubset/sft.cxx  |5 +-
 vcl/unx/generic/fontmanager/fontconfig.cxx |   51 -
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |6 +-
 4 files changed, 34 insertions(+), 32 deletions(-)

New commits:
commit dcf7792da2aa2a1ef774a124f7b21f68fff0fd15
Author: Khaled Hosny 
AuthorDate: Tue Aug 27 15:19:15 2019 +0200
Commit: Khaled Hosny 
CommitDate: Tue Sep 3 23:48:17 2019 +0200

Make Noto Color Emoji font work on Linux

Noto Color Emoji is a bitmap color font, Cairo knows how to scale such
fonts and FontConfig will identify them as scalable but not outline
fonts, so change the FontConfig checks to checks for scalability.

Make sft.cxx:doOpenTTFont() accept non-outline fonts, the text will not
show in PDF but that is not worse than the status quo.

Change-Id: I756c718296d2c43e3165cd2f07b11bbb981318d3
Reviewed-on: https://gerrit.libreoffice.org/78218
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 72a5a77cc6fe..4da3575d7597 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -381,8 +381,8 @@ void 
ImplFontMetricData::ImplCalcLineSpacing(LogicalFontInstance *pFontInstance)
 if (mnAscent || mnDescent)
 mnIntLeading = mnAscent + mnDescent - mnHeight;
 
-SAL_INFO("vcl.gdi.fontmetric",
-  "fsSelection: "   << rInfo.fsSelection
+SAL_INFO("vcl.gdi.fontmetric", GetFamilyName()
+ << ": fsSelection: "   << rInfo.fsSelection
  << ", typoAscender: "  << rInfo.typoAscender
  << ", typoDescender: " << rInfo.typoDescender
  << ", typoLineGap: "   << rInfo.typoLineGap
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 47e4f7a8d7f4..52b2e0360b50 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1669,7 +1669,10 @@ static SFErrCodes doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 /* TODO: implement to get subsetting */
 assert(t->goffsets != nullptr);
 } else {
-return SFErrCodes::TtFormat;
+// Bitmap font, accept for now.
+t->goffsets = static_cast(calloc(1+t->nglyphs, 
sizeof(sal_uInt32)));
+/* TODO: implement to get subsetting */
+assert(t->goffsets != nullptr);
 }
 
 table = getTable(t, O_hhea);
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 3f0a2aa4418b..9fd6b380b73a 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -67,7 +67,7 @@ namespace
 
 class FontCfgWrapper
 {
-FcFontSet* m_pOutlineSet;
+FcFontSet* m_pFontSet;
 
 void addFontSet( FcSetName );
 
@@ -95,17 +95,14 @@ private:
 };
 
 FontCfgWrapper::FontCfgWrapper()
-: m_pOutlineSet( nullptr )
+: m_pFontSet( nullptr )
 {
 FcInit();
 }
 
 void FontCfgWrapper::addFontSet( FcSetName eSetName )
 {
-/*
-  add only acceptable outlined fonts to our config,
-  for future fontconfig use
-*/
+// Add only acceptable fonts to our config, for future fontconfig use.
 FcFontSet* pOrig = FcConfigGetFonts( FcConfigGetCurrent(), eSetName );
 if( !pOrig )
 return;
@@ -114,10 +111,12 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
 for( int i = 0; i < pOrig->nfont; ++i )
 {
 FcPattern* pPattern = pOrig->fonts[i];
-// #i115131# ignore non-outline fonts
-FcBool bOutline = FcFalse;
-FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, 
 );
-if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
+// #i115131# ignore non-scalable fonts
+// Scalable fonts are usually outline fonts, but some bitmaps fonts
+// (like Noto Color Emoji) are also scalable.
+FcBool bScalable = FcFalse;
+FcResult eScalableRes = FcPatternGetBool(pPattern, FC_SCALABLE, 0, 
);
+if ((eScalableRes != FcResultMatch) || (bScalable == FcFalse))
 continue;
 
 // Ignore Type 1 fonts, too.
@@ -127,7 +126,7 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
 continue;
 
 FcPatternReference( pPattern );
-FcFontSetAdd( m_pOutlineSet, pPattern );
+FcFontSetAdd( m_pFontSet, pPattern );
 }
 
 // TODO?: FcFontSetDestroy( pOrig );
@@ -218,16 +217,16 @@ namespace
 
 FcFontSet* FontCfgWrapper::getFontSet()
 {
-if( !m_pOutlineSet )
+if( !m_pFontSet )
 {
-m_pOutlineSet = FcFontSetCreate();
+m_pFontSet = FcFontSetCreate();
 addFontSet( FcSetSystem );
 addFontSet( FcSetApplication );
 
-
::std::sort(m_pOutlineSet->fonts,m_pOutlineSet->fonts+m_pOutlineSet->nfont,SortFont());
+

[Libreoffice-commits] core.git: Branch 'private/khaledhosny/vcl-cleanup-font' - 161 commits - accessibility/source android/source basic/inc basic/qa basic/source bin/update_pch chart2/qa chart2/source

2019-09-03 Thread Khaled Hosny (via logerrit)
Rebased ref, commits from common ancestor:
commit 5b241d21b737d4f91ae4eb491b5c0d8c4043a055
Author: Khaled Hosny 
AuthorDate: Tue Sep 3 14:40:42 2019 +0200
Commit: Khaled Hosny 
CommitDate: Tue Sep 3 16:34:40 2019 +0200

Consolidate GetFontCapabilities()

All implementations were basically doing the same thing. Move to
PhysicalFontFace and use HarfBuzz API to get the raw OpeenType table
data.

Change-Id: Ia5ac0d1ba6299f86e90e1b0dac34ba7672855ec0

diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx
index 35cbf923665d..944ecceee303 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/PhysicalFontFace.hxx
@@ -22,6 +22,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -70,6 +71,7 @@ public:
 sal_Int32   CompareIgnoreSize( const PhysicalFontFace& ) const;
 
 const FontCharMapRef&   GetCharMap() const;
+boolGetCapabilities(vcl::FontCapabilities 
) const;
 
 hb_face_t*  GetHbFace() const { return mpHbFace; }
 virtual hb_blob_t*  GetHbTable(const char* pName) = 0;
@@ -84,6 +86,8 @@ protected:
 hb_face_t*  mpHbFace;
 
 mutable FontCharMapRef  mxCharMap;
+mutable boolmbCapabilitiesRead;
+mutable vcl::FontCapabilities maCapabilities;
 };
 
 #endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
diff --git a/vcl/inc/qt5/Qt5FontFace.hxx b/vcl/inc/qt5/Qt5FontFace.hxx
index 14da580393d8..d57e5e450977 100644
--- a/vcl/inc/qt5/Qt5FontFace.hxx
+++ b/vcl/inc/qt5/Qt5FontFace.hxx
@@ -42,8 +42,6 @@ public:
 
 int GetFontTable(const char pTagName[5], unsigned char*) const;
 
-bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const;
-
 rtl::Reference
 CreateFontInstance(const FontSelectPattern& rFSD) const override;
 
@@ -55,8 +53,6 @@ protected:
 
 private:
 const QString m_aFontId;
-mutable vcl::FontCapabilities m_aFontCapabilities;
-mutable bool m_bFontCapabilitiesRead;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index fa4e6e780a47..540a4acd2d9f 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -67,16 +67,12 @@ public:
 int GetFontTable( uint32_t nTagCode, unsigned 
char* ) const;
 int GetFontTable( const char pTagName[5], 
unsigned char* ) const;
 
-boolGetFontCapabilities(vcl::FontCapabilities 
) const;
-
 rtl::Reference CreateFontInstance(const 
FontSelectPattern&) const override;
 
 hb_blob_t*  GetHbTable(const char* pName) override;
 
 private:
 const sal_IntPtrmnFontId;
-mutable vcl::FontCapabilities   maFontCapabilities;
-mutable boolmbFontCapabilitiesRead;
 };
 
 class CoreTextStyle final : public LogicalFontInstance
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index fb2f4deac56d..04dcc4738db8 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -71,24 +71,16 @@ public:
 BYTEGetCharSet() const  { return meWinCharSet; 
}
 BYTEGetPitchAndFamily() const   { return 
mnPitchAndFamily; }
 
-bool GetFontCapabilities(vcl::FontCapabilities ) const;
-
 hb_blob_t*  GetHbTable(const char* pName) override;
 
 private:
 sal_IntPtr  mnId;
 
-// some members that are initialized lazily when the font gets selected 
into a HDC
-mutable boolmbFontCapabilitiesRead;
-mutable vcl::FontCapabilities   maFontCapabilities;
-
 BYTEmeWinCharSet;
 BYTEmnPitchAndFamily;
 boolmbAliasSymbolsHigh;
 boolmbAliasSymbolsLow;
 
-voidGetFontCapabilities( HDC hDC ) const;
-
 HDC mhDC;
 };
 
diff --git a/vcl/qt5/Qt5FontFace.cxx b/vcl/qt5/Qt5FontFace.cxx
index ea7770bf78a3..a7af63a4018e 100644
--- a/vcl/qt5/Qt5FontFace.cxx
+++ b/vcl/qt5/Qt5FontFace.cxx
@@ -130,7 +130,6 @@ Qt5FontFace* Qt5FontFace::fromQFontDatabase(const QString& 
aFamily, const QStrin
 Qt5FontFace::Qt5FontFace(const FontAttributes& rFA, const QString& rFontID)
 : PhysicalFontFace(rFA)
 , m_aFontId(rFontID)
-, m_bFontCapabilitiesRead(false)
 {
 }
 
@@ -142,31 +141,6 @@ Qt5FontFace::CreateFontInstance(const FontSelectPattern& 
rFSD) const
 return new Qt5Font(*this, rFSD);
 }
 
-bool Qt5FontFace::GetFontCapabilities(vcl::FontCapabilities& 
rFontCapabilities) const
-{
-// read this only once per font
-if (m_bFontCapabilitiesRead)
-{
-rFontCapabilities = m_aFontCapabilities;
-return rFontCapabilities.oUnicodeRange || 
rFontCapabilities.oCodePageRange;
-}
-m_bFontCapabilitiesRead = true;
-
-QFont aFont;
-aFont.fromString(m_aFontId);
-QRawFont 

[Libreoffice-commits] core.git: Changes to 'private/khaledhosny/vcl-cleanup-font'

2019-09-03 Thread Khaled Hosny (via logerrit)
New branch 'private/khaledhosny/vcl-cleanup-font' available with the following 
commits:
commit c2663218c216abe3424aaf730f5379136a9e260a
Author: Khaled Hosny 
Date:   Tue Sep 3 14:40:42 2019 +0200

Consolidate GetFontCapabilities()

All implementations were basically doing the same thing. Move to
PhysicalFontFace and use HarfBuzz API to get the raw OpeenType table
data.

Change-Id: Ia5ac0d1ba6299f86e90e1b0dac34ba7672855ec0

commit d302923c758cba8e7542b7c58e0a504e2143c6ca
Author: Khaled Hosny 
Date:   Tue Sep 3 13:21:50 2019 +0200

Drop SalGraphics::GetGlyphWidths()

It was used only on two places. One use is replaced with a new
LogicalFontInstance::GetGlyphWidth() (backed by HarfBuzz font) and the
other is replaced by getting glyph widths while subsetting the font.

PDFFontCache is now unused, so dropped as well.

Change-Id: I9741f17c0a5626faa952dd0d417cc786cbc877cd

commit 7767c613625c4841a6087bb6ac2d7cd99bda1391
Author: Khaled Hosny 
Date:   Wed Aug 28 18:22:25 2019 +0200

Consolidate GetFontCharMap()

All implementations were basically doing the same thing. Move to
PhysicalFontFace and use HarfBuzz API to get the raw OpeenType table
data.

While at make a few other places use that FontCharMap as well instead of
parsing the cmap table again.

Drop unused HasChar() as well.

Change-Id: I06ff4feb61bcfb17291bf3c299caf11fc53afa4d

commit 6ed2874e2fd1a0f15dc5692756f790676c06aef4
Author: Khaled Hosny 
Date:   Wed Aug 28 17:24:51 2019 +0200

Move creating HarfBuzz face to PhysicalFontFace

The two map to each other; there are many size-specific
LogicalFontInstance's in each PhysicalFontFace, and ditto for hb_face_t
and hb_font_t.

This will make it possible to access HarfBuzz face from PhysicalFontFace
in the future.

Change-Id: I029ad8c4b619b55a2c629f813b9e60bda29b1c08

commit 81bf06c8fab6fcda3edd6cfa025732828003fbd0
Author: Khaled Hosny 
Date:   Wed Aug 28 12:50:22 2019 +0200

Merge GetFontCodeRanges() into GetFontCharMap()

Change-Id: I61d8edf0be492c1c06274c11ac5d2e65415525a9

commit bffc3a013889b27cde392f0a1e8bf2a341b0df26
Author: Khaled Hosny 
Date:   Wed Aug 28 12:46:19 2019 +0200

Remove effectively dead code

We dropped support for non-SFNT fonts for a while now.

Change-Id: Iaa2ea308effa7328bd84240cf29fc3fd117d418a

commit 4fcfa1210b6a9591f23111618868b18f4301a644
Author: Khaled Hosny 
Date:   Tue Aug 27 15:19:15 2019 +0200

Make Noto Color Emoji font work on Linux

Noto Color Emoji is a bitmap color font, Cairo knows how to scale such
fonts and FontConfig will identify them as scalable but not outline
fonts, so change the FontConfig checks to checks for scalability.

Make sft.cxx:doOpenTTFont() accept non-outline fonts, the text will not
show in PDF but that is not worse than the status quo.

Change-Id: I756c718296d2c43e3165cd2f07b11bbb981318d3

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-27 Thread Khaled Hosny (via logerrit)
 vcl/inc/impfontmetricdata.hxx  |5 +---
 vcl/inc/sft.hxx|4 +--
 vcl/qt5/Qt5Graphics_Text.cxx   |8 --
 vcl/quartz/ctfonts.cxx |   18 ---
 vcl/source/font/fontmetric.cxx |   22 ++
 vcl/source/fontsubset/sft.cxx  |   30 -
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |   10 
 vcl/win/gdi/salfont.cxx|   10 
 8 files changed, 40 insertions(+), 67 deletions(-)

New commits:
commit 60d4be99383b6fe13ca55572c43fd022bdc73ce8
Author: Khaled Hosny 
AuthorDate: Sun Aug 25 14:12:15 2019 +0200
Commit: Khaled Hosny 
CommitDate: Tue Aug 27 20:38:19 2019 +0200

Consolidate ImplCalcLineSpacing()

Move getting UPEM and font tables to the functions and use HarfBuzz API
to get them. In the future we might stop reading the tables ourselves
and use HarfBuzz metrics API instead.

Change-Id: I3f4511628fd33200bae94cdcd96479ba3e6d2fba
Reviewed-on: https://gerrit.libreoffice.org/78081
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index 73beb59722db..6250c9155436 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -32,6 +32,7 @@ typedef tools::SvRef 
ImplFontMetricDataRef;
 
 class OutputDevice;
 class FontSelectPattern;
+class LogicalFontInstance;
 
 class VCL_DLLPUBLIC ImplFontMetricData : public FontAttributes, public 
SvRefBase
 {
@@ -92,9 +93,7 @@ public:
 voidImplInitTextLineSize( const OutputDevice* pDev );
 voidImplInitAboveTextLineSize();
 voidImplInitFlags( const OutputDevice* pDev );
-voidImplCalcLineSpacing(const std::vector& rHhea,
-const std::vector& rOS_2,
-int nUPEM);
+voidImplCalcLineSpacing(LogicalFontInstance *pFontInstance);
 
 private:
 boolShouldUseWinMetrics(const vcl::TTGlobalFontInfo& rInfo);
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index fbf570b27adb..aa81dcd151cb 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -419,8 +419,8 @@ namespace vcl
  * @ingroup sft
  *
  */
- void GetTTFontMetrics(const std::vector& hhea,
-   const std::vector& os2,
+ void GetTTFontMetrics(const uint8_t *pHhea, size_t nHhea,
+   const uint8_t *pOs2, size_t nOs2,
TTGlobalFontInfo *info);
 
 /**
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 38723f3dd623..85b51b82b1eb 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -59,13 +59,7 @@ void Qt5Graphics::GetFontMetric(ImplFontMetricDataRef& rFMD, 
int nFallbackLevel)
 QRawFont aRawFont(QRawFont::fromFont(*m_pTextStyle[nFallbackLevel]));
 Qt5FontFace::fillAttributesFromQFont(*m_pTextStyle[nFallbackLevel], *rFMD);
 
-QByteArray aHheaTable = aRawFont.fontTable("hhea");
-std::vector rHhea(aHheaTable.data(), aHheaTable.data() + 
aHheaTable.size());
-
-QByteArray aOs2Table = aRawFont.fontTable("OS/2");
-std::vector rOS2(aOs2Table.data(), aOs2Table.data() + 
aOs2Table.size());
-
-rFMD->ImplCalcLineSpacing(rHhea, rOS2, aRawFont.unitsPerEm());
+rFMD->ImplCalcLineSpacing(m_pTextStyle[nFallbackLevel].get());
 
 rFMD->SetSlant(0);
 rFMD->SetWidth(aRawFont.averageCharWidth());
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 06a25965653f..252720a0aa4e 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -110,24 +110,8 @@ void CoreTextStyle::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 ));
-const CoreTextFontFace* mpFontData = static_cast(GetFontFace());
 
-int nBufSize = 0;
-
-nBufSize = mpFontData->GetFontTable("hhea", nullptr);
-uint8_t* pHheaBuf = new uint8_t[nBufSize];
-nBufSize = mpFontData->GetFontTable("hhea", pHheaBuf);
-std::vector rHhea(pHheaBuf, pHheaBuf + nBufSize);
-
-nBufSize = mpFontData->GetFontTable("OS/2", nullptr);
-uint8_t* pOS2Buf = new uint8_t[nBufSize];
-nBufSize = mpFontData->GetFontTable("OS/2", pOS2Buf);
-std::vector rOS2(pOS2Buf, pOS2Buf + nBufSize);
-
-rxFontMetric->ImplCalcLineSpacing(rHhea, rOS2, 
CTFontGetUnitsPerEm(aCTFontRef));
-
-delete[] pHheaBuf;
-delete[] pOS2Buf;
+rxFontMetric->ImplCalcLineSpacing(this);
 
 // since ImplFontMetricData::mnWidth is only used for stretching/squeezing 
fonts
 // setting this width to the pixel height of the fontsize is good enough
diff --git a/vcl/source/font/fontmetric.cxx 

[Libreoffice-commits] core.git: vcl/inc

2019-08-27 Thread Khaled Hosny (via logerrit)
 vcl/inc/fontinstance.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c997a32dbfddf791a309f179adca961336423293
Author: Khaled Hosny 
AuthorDate: Tue Aug 27 11:07:53 2019 +0200
Commit: Khaled Hosny 
CommitDate: Tue Aug 27 19:43:54 2019 +0200

Return empty HarfBuzz font instead of nullptr

hb_font_get_empty() returns an empty, singleton font object that can be
safely passed to HarfBuzz API that would otherwise crash if given a
nullptr. Keep the assert to catch calls to this code in debug builds,
since it is really a bug for LogicalFontInstance implementations without
a backed HarfBuzz font to call code that requires it.

Change-Id: I93e2b3204eb08b0c4c54587bc0f60cbf3c18c7d7
Reviewed-on: https://gerrit.libreoffice.org/78178
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index b22d76e3b070..b57955f82a9e 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -86,7 +86,7 @@ protected:
 
 // Takes ownership of pHbFace.
 static hb_font_t* InitHbFont(hb_face_t* pHbFace);
-virtual hb_font_t* ImplInitHbFont() { assert(false); return nullptr; }
+virtual hb_font_t* ImplInitHbFont() { assert(false); return 
hb_font_get_empty(); }
 inline void ReleaseHbFont();
 
 private:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-25 Thread Khaled Hosny (via logerrit)
 vcl/inc/fontinstance.hxx |2 -
 vcl/source/font/fontinstance.cxx |   43 +--
 2 files changed, 42 insertions(+), 3 deletions(-)

New commits:
commit 502d73cda8fa1f482634bb6435fd1440757fdad9
Author: Khaled Hosny 
AuthorDate: Wed Aug 21 11:17:53 2019 +0200
Commit: Khaled Hosny 
CommitDate: Sun Aug 25 12:07:57 2019 +0200

Use HarfBuzz to get glyph bounding rectangle

For consistent cross-platform results that also matches our glyph
advances since platform functions might be using hints which we don’t
use.

Keep platform-specific implementations as fallback since HarfBuzz
internal font functions (that we use) did not support glyph extents for
fonts with CFF table before 2.3.0.

Change-Id: I62c6c703ea37d41fd0998309dacadd56565a0fae
Reviewed-on: https://gerrit.libreoffice.org/77870
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index fc3f206dba56..b22d76e3b070 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -71,7 +71,7 @@ public: // TODO: make data members private
 const PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); }
 const ImplFontCache* GetFontCache() const { return mpFontCache; }
 
-bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const;
+bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool);
 virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) 
const = 0;
 
 int GetKashidaWidth();
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 58d72083f130..808f2d0a5c27 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -144,12 +144,51 @@ void LogicalFontInstance::IgnoreFallbackForUnicode( 
sal_UCS4 cChar, FontWeight e
 mpUnicodeFallbackList->erase( it );
 }
 
-bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle 
, bool bVertical) const
+bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle 
, bool bVertical)
 {
 if (mpFontCache && mpFontCache->GetCachedGlyphBoundRect(this, nID, rRect))
 return true;
 
-bool res = ImplGetGlyphBoundRect(nID, rRect, bVertical);
+hb_font_t* pHbFont = GetHbFont();
+hb_glyph_extents_t aExtents;
+bool res = hb_font_get_glyph_extents(pHbFont, nID, );
+if (res)
+{
+double nXScale = 0, nYScale = 0;
+GetScale(, );
+
+double fMinX = aExtents.x_bearing;
+double fMinY = aExtents.y_bearing;
+double fMaxX = aExtents.x_bearing + aExtents.width;
+double fMaxY = aExtents.y_bearing + aExtents.height;
+
+tools::Rectangle aRect( std::floor(fMinX * nXScale),
+   -std::ceil(fMinY  * nYScale),
+std::ceil(fMaxX  * nXScale),
+   -std::floor(fMaxY * nYScale));
+
+if (mnOrientation && !bVertical)
+{
+// Apply font rotation.
+const double fRad = basegfx::deg2rad(mnOrientation);
+const double fCos = cos(fRad);
+const double fSin = sin(fRad);
+
+rRect.SetLeft(   fCos * aRect.Left() + fSin * aRect.Top());
+rRect.SetTop(   -fSin * aRect.Left() - fCos * aRect.Top());
+rRect.SetRight(  fCos * aRect.Right() + fSin * aRect.Bottom());
+rRect.SetBottom(-fSin * aRect.Right() - fCos * aRect.Bottom());
+}
+else
+rRect = aRect;
+}
+else
+{
+// Fallback to platform implementations.
+// TODO: remove once we require HarfBuzz >= 2.3.0
+res = ImplGetGlyphBoundRect(nID, rRect, bVertical);
+}
+
 if (mpFontCache && res)
 mpFontCache->CacheGlyphBoundRect(this, nID, rRect);
 return res;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: download.lst external/harfbuzz

2019-08-20 Thread Khaled Hosny (via logerrit)
 download.lst  |4 ++--
 external/harfbuzz/ExternalProject_harfbuzz.mk |1 -
 external/harfbuzz/UnpackedTarball_harfbuzz.mk |6 --
 external/harfbuzz/msvc.patch  |   17 -
 4 files changed, 2 insertions(+), 26 deletions(-)

New commits:
commit 352924a64750bb99aec54feea3af0121603c12a8
Author: Khaled Hosny 
AuthorDate: Tue Aug 20 10:33:40 2019 +0200
Commit: Khaled Hosny 
CommitDate: Tue Aug 20 20:08:59 2019 +0200

Update HarfBbuzz to 2.6.0

Change-Id: I7983dd10fe6599a2473caf0da04a0df3e63e9b2a
Reviewed-on: https://gerrit.libreoffice.org/77790
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/download.lst b/download.lst
index 4539a35a9b3c..c0217d93b9d0 100644
--- a/download.lst
+++ b/download.lst
@@ -96,8 +96,8 @@ export GPGME_SHA256SUM := 
1b29fedb8bfad775e70eafac5b0590621683b2d9869db994568e64
 export GPGME_TARBALL := gpgme-1.9.0.tar.bz2
 export GRAPHITE_SHA256SUM := 
d47d387161db7f7ebade1920aa7cbdc797e79772597d8b55e80b58d1071bcc36
 export GRAPHITE_TARBALL := graphite2-minimal-1.3.13.tgz
-export HARFBUZZ_SHA256SUM := 
f205699d5b91374008d6f8e36c59e419ae2d9a7bb8c5d9f34041b9a5abcae468
-export HARFBUZZ_TARBALL := harfbuzz-2.3.1.tar.bz2
+export HARFBUZZ_SHA256SUM := 
9cf7d117548265f95ca884e2f4c9fafaf4e17d45a67b11107147b79eed76c966
+export HARFBUZZ_TARBALL := harfbuzz-2.6.0.tar.xz
 export HSQLDB_SHA256SUM := 
d30b13f4ba2e3b6a2d4f020c0dee0a9fb9fc6fbcc2d561f36b78da4bf3802370
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
 export HUNSPELL_SHA256SUM := 
57be4e03ae9dd62c3471f667a0d81a14513e314d4d92081292b90435944ff951
diff --git a/external/harfbuzz/ExternalProject_harfbuzz.mk 
b/external/harfbuzz/ExternalProject_harfbuzz.mk
index 6a8b46f722ea..9bb2f5b9bc71 100644
--- a/external/harfbuzz/ExternalProject_harfbuzz.mk
+++ b/external/harfbuzz/ExternalProject_harfbuzz.mk
@@ -36,7 +36,6 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) :
--with-fontconfig=no \
--with-cairo=no \
--with-glib=no \
-   --with-ucdn=no \
--with-graphite2=yes \
$(if 
$(verbose),--disable-silent-rules,--enable-silent-rules) \
--libdir=$(call 
gb_UnpackedTarball_get_dir,harfbuzz/src/.libs) \
diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk 
b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index 8101f244f4df..a99f116d80ad 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -15,10 +15,4 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,harfbuzz))
 
 $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
 
-# * external/harfbuzz/msvc.patch sent upstream as 

-#   "Fix hb_atomic_* variants based on C++11 atomics":
-$(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
-external/harfbuzz/msvc.patch \
-))
-
 # vim: set noet sw=4 ts=4:
diff --git a/external/harfbuzz/msvc.patch b/external/harfbuzz/msvc.patch
deleted file mode 100644
index f6796a99bf8e..
--- a/external/harfbuzz/msvc.patch
+++ /dev/null
@@ -1,17 +0,0 @@
 src/hb-atomic.hh
-+++ src/hb-atomic.hh
-@@ -85,11 +85,11 @@
- #define hb_atomic_int_impl_add(AI, V) 
(reinterpret_cast *> (AI)->fetch_add ((V), 
std::memory_order_acq_rel))
- #define hb_atomic_int_impl_set_relaxed(AI, V) 
(reinterpret_cast *> (AI)->store ((V), 
std::memory_order_relaxed))
- #define hb_atomic_int_impl_set(AI, V) 
(reinterpret_cast *> (AI)->store ((V), 
std::memory_order_release))
--#define hb_atomic_int_impl_get_relaxed(AI)
(reinterpret_cast *> (AI)->load (std::memory_order_relaxed))
--#define hb_atomic_int_impl_get(AI)
(reinterpret_cast *> (AI)->load (std::memory_order_acquire))
-+#define hb_atomic_int_impl_get_relaxed(AI)
(reinterpret_cast const *> (AI)->load 
(std::memory_order_relaxed))
-+#define hb_atomic_int_impl_get(AI)
(reinterpret_cast const *> (AI)->load 
(std::memory_order_acquire))
- 
- #define hb_atomic_ptr_impl_set_relaxed(P, V)  
(reinterpret_cast *> (P)->store ((V), 
std::memory_order_relaxed))
--#define hb_atomic_ptr_impl_get_relaxed(P) 
(reinterpret_cast *> (P)->load (std::memory_order_relaxed))
-+#define hb_atomic_ptr_impl_get_relaxed(P) 
(reinterpret_cast const *> (P)->load 
(std::memory_order_relaxed))
- #define hb_atomic_ptr_impl_get(P) 
(reinterpret_cast *> (P)->load (std::memory_order_acquire))
- static inline bool
- _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-19 Thread Khaled Hosny (via logerrit)
 vcl/inc/win/salgdi.h|2 +-
 vcl/win/gdi/salfont.cxx |   16 
 2 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 362b872305d3b3500ef6f0823e5d30433dcfe48e
Author: Khaled Hosny 
AuthorDate: Thu Jun 20 02:13:04 2019 +0200
Commit: Khaled Hosny 
CommitDate: Thu Jun 20 04:08:25 2019 +0200

Remove leftover from bitmap fonts support on Windows

The condition "nFontType & RASTER_FONTTYPE" can never be true since we 
reject
such fonts, so nHeight is always zero and we can simplify the code a bit
accordingly.

Change-Id: Ib3a19777909e16367c8168e86e474c1a5ee64a5b
Reviewed-on: https://gerrit.libreoffice.org/74400
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 7dc859a1a551..23f201fea6fa 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -59,7 +59,7 @@ class WinFontFace : public PhysicalFontFace
 {
 public:
 explicitWinFontFace( const FontAttributes&,
-int nFontHeight, BYTE eWinCharSet,
+BYTE eWinCharSet,
 BYTE nPitchAndFamily  );
 virtual ~WinFontFace() override;
 
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 181bbcec633b..fcdbb6484dda 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -559,16 +559,10 @@ static FontAttributes WinFont2DevFontAttributes( const 
ENUMLOGFONTEXW& rEnumFont
 
 
 static rtl::Reference ImplLogMetricToDevFontDataW( const 
ENUMLOGFONTEXW* pLogFont,
- const NEWTEXTMETRICW* pMetric,
- DWORD nFontType )
+ const NEWTEXTMETRICW* pMetric)
 {
-int nHeight = 0;
-if ( nFontType & RASTER_FONTTYPE )
-nHeight = pMetric->tmHeight - pMetric->tmInternalLeading;
-
 rtl::Reference pData = new WinFontFace(
 WinFont2DevFontAttributes(*pLogFont, *pMetric),
-nHeight,
 pLogFont->elfLogFont.lfCharSet,
 pMetric->tmPitchAndFamily );
 
@@ -613,7 +607,7 @@ void ImplSalLogFontToFontW( HDC hDC, const LOGFONTW& 
rLogFont, Font& rFont )
 }
 
 WinFontFace::WinFontFace( const FontAttributes& rDFS,
-int nHeight, BYTE eWinCharSet, BYTE nPitchAndFamily )
+BYTE eWinCharSet, BYTE nPitchAndFamily )
 :   PhysicalFontFace( rDFS ),
 mnId( 0 ),
 mbFontCapabilitiesRead( false ),
@@ -622,8 +616,6 @@ WinFontFace::WinFontFace( const FontAttributes& rDFS,
 mbAliasSymbolsHigh( false ),
 mbAliasSymbolsLow( false )
 {
-SetBitmapSize( 0, nHeight );
-
 if( eWinCharSet == SYMBOL_CHARSET )
 {
 if( (nPitchAndFamily & TMPF_TRUETYPE) != 0 )
@@ -1052,7 +1044,7 @@ static int CALLBACK SalEnumFontsProcExW( const LOGFONTW* 
lpelfe,
 return 1;
 }
 
-rtl::Reference pData = ImplLogMetricToDevFontDataW( 
pLogFont, &(pMetric->ntmTm), nFontType );
+rtl::Reference pData = 
ImplLogMetricToDevFontDataW(pLogFont, &(pMetric->ntmTm));
 pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
 
 pInfo->mpList->Add( pData.get() );
@@ -1222,7 +1214,7 @@ bool WinSalGraphics::AddTempDevFont( 
PhysicalFontCollection* pFontCollection,
 aDFS.maMapName = aFontName;
 */
 
-rtl::Reference pFontData = new WinFontFace( aDFA, 0,
+rtl::Reference pFontData = new WinFontFace(aDFA,
 sal::static_int_cast(DEFAULT_CHARSET),
 sal::static_int_cast(TMPF_VECTOR|TMPF_TRUETYPE) );
 pFontData->SetFontId( reinterpret_cast(pFontData.get()) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-2-5' - vcl/inc

2019-06-17 Thread Khaled Hosny (via logerrit)
 vcl/inc/fontinstance.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9f095d0bc6b091ca8e0522533c981374d0648c09
Author: Khaled Hosny 
AuthorDate: Sun Jun 16 02:38:02 2019 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Jun 17 18:40:38 2019 +0200

tdf#121486: Correct scale of broken fonts on Windows

Some fonts have negative tmAveCharWidth which makes no sense (fonts can't 
have
negative glyph width, so the average can't be negative) and it would cause 
our
code to apply negative scale to the glyphs of these fonts making them drawn 
on
the flipped horizontally.

Fix this by using the absolute value so it is always positive.

Change-Id: I731e7aad80dae734847679a1b08c6ac78111e16c
Reviewed-on: https://gerrit.libreoffice.org/74109
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 
(cherry picked from commit 8fffb56940c6eb81674000cdb718edc79603a6c5)
Reviewed-on: https://gerrit.libreoffice.org/74150
Reviewed-by: Michael Stahl 
Reviewed-by: Xisco Faulí 
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index 58bcd07927a0..f8199669952f 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -63,7 +63,7 @@ public: // TODO: make data members private
 voidIgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, 
const OUString& rFontName );
 
 inline hb_font_t* GetHbFont();
-void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = nFactor; }
+void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = 
std::abs(nFactor); }
 double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
 const FontSelectPattern& GetFontSelectPattern() const { return 
m_aFontSelData; }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - vcl/inc

2019-06-16 Thread Khaled Hosny (via logerrit)
 vcl/inc/fontinstance.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cd33eb812277f516f4670edfffd68e5b763e8a4c
Author: Khaled Hosny 
AuthorDate: Sun Jun 16 02:38:02 2019 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Jun 17 01:19:36 2019 +0200

tdf#121486: Correct scale of broken fonts on Windows

Some fonts have negative tmAveCharWidth which makes no sense (fonts can't 
have
negative glyph width, so the average can't be negative) and it would cause 
our
code to apply negative scale to the glyphs of these fonts making them drawn 
on
the flipped horizontally.

Fix this by using the absolute value so it is always positive.

Change-Id: I731e7aad80dae734847679a1b08c6ac78111e16c
Reviewed-on: https://gerrit.libreoffice.org/74109
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 
(cherry picked from commit 8fffb56940c6eb81674000cdb718edc79603a6c5)
Reviewed-on: https://gerrit.libreoffice.org/74123
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index 58bcd07927a0..f8199669952f 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -63,7 +63,7 @@ public: // TODO: make data members private
 voidIgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, 
const OUString& rFontName );
 
 inline hb_font_t* GetHbFont();
-void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = nFactor; }
+void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = 
std::abs(nFactor); }
 double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
 const FontSelectPattern& GetFontSelectPattern() const { return 
m_aFontSelData; }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc

2019-06-16 Thread Khaled Hosny (via logerrit)
 vcl/inc/fontinstance.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cd7b82ecb9c7b96b29087e70b66210a3de5a4434
Author: Khaled Hosny 
AuthorDate: Sun Jun 16 02:38:02 2019 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Jun 16 21:03:50 2019 +0200

tdf#121486: Correct scale of broken fonts on Windows

Some fonts have negative tmAveCharWidth which makes no sense (fonts can't 
have
negative glyph width, so the average can't be negative) and it would cause 
our
code to apply negative scale to the glyphs of these fonts making them drawn 
on
the flipped horizontally.

Fix this by using the absolute value so it is always positive.

Change-Id: I731e7aad80dae734847679a1b08c6ac78111e16c
Reviewed-on: https://gerrit.libreoffice.org/74109
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 
(cherry picked from commit 8fffb56940c6eb81674000cdb718edc79603a6c5)
Reviewed-on: https://gerrit.libreoffice.org/74122
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index a0f700c925fc..62e3677db7a4 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -64,7 +64,7 @@ public: // TODO: make data members private
 voidIgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, 
const OUString& rFontName );
 
 inline hb_font_t* GetHbFont();
-void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = nFactor; }
+void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = 
std::abs(nFactor); }
 double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
 const FontSelectPattern& GetFontSelectPattern() const { return 
m_aFontSelData; }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: vcl/inc

2019-06-16 Thread Khaled Hosny (via logerrit)
 vcl/inc/fontinstance.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8fffb56940c6eb81674000cdb718edc79603a6c5
Author: Khaled Hosny 
AuthorDate: Sun Jun 16 02:38:02 2019 +0200
Commit: Khaled Hosny 
CommitDate: Sun Jun 16 17:16:10 2019 +0200

tdf#121486: Correct scale of broken fonts on Windows

Some fonts have negative tmAveCharWidth which makes no sense (fonts can't 
have
negative glyph width, so the average can't be negative) and it would cause 
our
code to apply negative scale to the glyphs of these fonts making them drawn 
on
the flipped horizontally.

Fix this by using the absolute value so it is always positive.

Change-Id: I731e7aad80dae734847679a1b08c6ac78111e16c
Reviewed-on: https://gerrit.libreoffice.org/74109
Tested-by: Jenkins
Reviewed-by: Khaled Hosny 

diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index 7c4c6d371804..fc3f206dba56 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -64,7 +64,7 @@ public: // TODO: make data members private
 voidIgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, 
const OUString& rFontName );
 
 inline hb_font_t* GetHbFont();
-void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = nFactor; }
+void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = 
std::abs(nFactor); }
 double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
 const FontSelectPattern& GetFontSelectPattern() const { return 
m_aFontSelData; }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: vcl/source

2019-06-04 Thread Khaled Hosny (via logerrit)
 vcl/source/gdi/CommonSalLayout.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 8736cc0f5c6d4cb80ccb39ca6797d2f4490dade9
Author: Khaled Hosny 
AuthorDate: Tue Jun 4 03:57:00 2019 +0200
Commit: Khaled Hosny 
CommitDate: Tue Jun 4 14:46:24 2019 +0200

Use ICU UCHAR_VERTICAL_ORIENTATION when available

Starting from ICU 63, the vertical orientation property is provided by ICU 
so
we use it instead of our inyternal, and potentially outdated data file. Old
code is kept until support for ICU < 63 is dropped.

Change-Id: I0df1f3f5e853ca90945a36a8123bec9ae7f691cc
Reviewed-on: https://gerrit.libreoffice.org/73425
Tested-by: Jenkins
Reviewed-by: Mark Hung 

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index e146fb245131..90c519385bd2 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -121,6 +121,14 @@ namespace vcl {
 } // namespace vcl
 
 namespace {
+#if U_ICU_VERSION_MAJOR_NUM >= 63
+enum class VerticalOrientation {
+Upright= U_VO_UPRIGHT,
+Rotated= U_VO_ROTATED,
+TransformedUpright = U_VO_TRANSFORMED_UPRIGHT,
+TransformedRotated = U_VO_TRANSFORMED_ROTATED
+};
+#else
 #include "VerticalOrientationData.cxx"
 
 // These must match the values in the file included above.
@@ -130,6 +138,7 @@ namespace {
 TransformedUpright = 2,
 TransformedRotated = 3
 };
+#endif
 
 VerticalOrientation GetVerticalOrientation(sal_UCS4 cCh, const 
LanguageTag& rTag)
 {
@@ -140,6 +149,9 @@ namespace {
 && rTag.getLanguage() == "zh")
 return VerticalOrientation::TransformedUpright;
 
+#if U_ICU_VERSION_MAJOR_NUM >= 63
+int32_t nRet = u_getIntPropertyValue(cCh, UCHAR_VERTICAL_ORIENTATION);
+#else
 uint8_t nRet = 1;
 
 if (cCh < 0x1)
@@ -158,6 +170,7 @@ namespace {
 // Default value for unassigned
 SAL_WARN("vcl.gdi", "Getting VerticalOrientation for codepoint 
outside Unicode range");
 }
+#endif
 
 return VerticalOrientation(nRet);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/source

2019-03-22 Thread Khaled Hosny (via logerrit)
 sw/source/core/txtnode/fntcache.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit b2e81e11e154b660172356969252f00ba63f3a2b
Author: Khaled Hosny 
AuthorDate: Thu Mar 21 18:00:54 2019 +0200
Commit: Miklos Vajna 
CommitDate: Fri Mar 22 14:57:56 2019 +0100

tdf#124109: Fix missing kashida glyphs

This partially reverts:

commit 436b829f5b904d76039db0818cff5dedf1ae89f1
Author: Miklos Vajna 
Date:   Thu Aug 16 17:35:17 2018 +0200

sw: save one vcl layout call in SwFntObj::DrawText()

Pressing a key in Writer used to lay out the relevant string 4 times
(counting GenericSalLayout::LayoutText() invocations), save one of them
by pre-calculating the layout and sharing it between GetTextArray() and
DrawTextArray().

The reverted part was causing inserted Kashida to be missing, leaving gaps
inside the words. See attachment in the bug report.

Change-Id: Iaafbc793ed5906e6fdf3dcb03c54d5a440e15da4
Reviewed-on: https://gerrit.libreoffice.org/69530
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit f8ca6e0a59bff51fcb09af4fa6d9cd458b32f223)
Reviewed-on: https://gerrit.libreoffice.org/69547

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 55278e70011c..175821ab90ef 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1811,9 +1811,8 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 ? (rInf.GetIdx() ? 1 : 0)
 : sal_Int32(rInf.GetIdx());
 aGlyphsKey = SwTextGlyphsKey{ (), *pStr, nTmpIdx, 
nLen };
-pGlyphs = lcl_CreateLayout(aGlyphsKey, 
m_aTextGlyphs[aGlyphsKey]);
 rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, 
pKernArray.get(),
- nTmpIdx , nLen, 
SalLayoutFlags::NONE, pGlyphs );
+ nTmpIdx , nLen );
 if (bBullet)
 {
 rInf.GetOut().Push();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

<    1   2   3   4   5