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

2019-08-04 Thread Martin Hosken (via logerrit)
 vcl/source/gdi/CommonSalLayout.cxx |  112 -
 1 file changed, 61 insertions(+), 51 deletions(-)

New commits:
commit 21a54877f7e819491d7984a3c318100fa2eddfae
Author: Martin Hosken 
AuthorDate: Wed Jul 24 10:25:44 2019 +0700
Commit: Martin Hosken 
CommitDate: Mon Aug 5 04:27:16 2019 +0200

Graphite fonts don't need runs broken by script

This allows Graphite fonts to work with unencoded characters (or those
just added to Unicode). It also allows cross script shaping if desired.

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

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 7d67014031cc..b77eca31a389 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -290,6 +291,7 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, 
const SalLayoutGlyphs*
 }
 
 hb_font_t *pHbFont = GetFont().GetHbFont();
+bool isGraphite = hb_graphite2_face_get_gr_face(hb_font_get_face(pHbFont)) 
!= nullptr;
 
 int nGlyphCapacity = 2 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos);
 m_GlyphItems.Impl()->reserve(nGlyphCapacity);
@@ -338,8 +340,8 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, 
const SalLayoutGlyphs*
 break;
 
 // Find script subruns.
-int nCurrentPos = nBidiMinRunPos;
 std::vector aSubRuns;
+int nCurrentPos = nBidiMinRunPos;
 size_t k = 0;
 for (; k < pTextLayout->runs.size(); ++k)
 {
@@ -350,67 +352,75 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, 
const SalLayoutGlyphs*
 }
 }
 
-while (nCurrentPos < nBidiEndRunPos && k < pTextLayout->runs.size())
+if (isGraphite)
 {
-int32_t nMinRunPos = nCurrentPos;
-int32_t nEndRunPos = std::min(pTextLayout->runs[k].nEnd, 
nBidiEndRunPos);
-hb_direction_t aDirection = bRightToLeft ? HB_DIRECTION_RTL : 
HB_DIRECTION_LTR;
 hb_script_t aScript = 
hb_icu_script_to_script(pTextLayout->runs[k].nCode);
-// For vertical text, further divide the runs based on character
-// orientation.
-if (rArgs.mnFlags & SalLayoutFlags::Vertical)
+aSubRuns.push_back({ nBidiMinRunPos, nBidiEndRunPos, aScript, 
bRightToLeft ? HB_DIRECTION_RTL : HB_DIRECTION_LTR });
+}
+else
+{
+while (nCurrentPos < nBidiEndRunPos && k < 
pTextLayout->runs.size())
 {
-sal_Int32 nIdx = nMinRunPos;
-while (nIdx < nEndRunPos)
+int32_t nMinRunPos = nCurrentPos;
+int32_t nEndRunPos = std::min(pTextLayout->runs[k].nEnd, 
nBidiEndRunPos);
+hb_direction_t aDirection = bRightToLeft ? HB_DIRECTION_RTL : 
HB_DIRECTION_LTR;
+hb_script_t aScript = 
hb_icu_script_to_script(pTextLayout->runs[k].nCode);
+// For vertical text, further divide the runs based on 
character
+// orientation.
+if (rArgs.mnFlags & SalLayoutFlags::Vertical)
 {
-sal_Int32 nPrevIdx = nIdx;
-sal_UCS4 aChar = rArgs.mrStr.iterateCodePoints();
-VerticalOrientation aVo = GetVerticalOrientation(aChar, 
rArgs.maLanguageTag);
-
-sal_UCS4 aVariationSelector = 0;
-if (nIdx < nEndRunPos)
+sal_Int32 nIdx = nMinRunPos;
+while (nIdx < nEndRunPos)
 {
-sal_Int32 nNextIdx = nIdx;
-sal_UCS4 aNextChar = 
rArgs.mrStr.iterateCodePoints();
-if (u_hasBinaryProperty(aNextChar, 
UCHAR_VARIATION_SELECTOR))
+sal_Int32 nPrevIdx = nIdx;
+sal_UCS4 aChar = rArgs.mrStr.iterateCodePoints();
+VerticalOrientation aVo = 
GetVerticalOrientation(aChar, rArgs.maLanguageTag);
+
+sal_UCS4 aVariationSelector = 0;
+if (nIdx < nEndRunPos)
 {
-nIdx = nNextIdx;
-aVariationSelector = aNextChar;
+sal_Int32 nNextIdx = nIdx;
+sal_UCS4 aNextChar = 
rArgs.mrStr.iterateCodePoints();
+if (u_hasBinaryProperty(aNextChar, 
UCHAR_VARIATION_SELECTOR))
+{
+nIdx = nNextIdx;
+aVariationSelector = aNextChar;
+}

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

2019-03-25 Thread Martin Hosken (via logerrit)
 cui/source/dialogs/FontFeaturesDialog.cxx |   30 ++
 cui/source/inc/FontFeaturesDialog.hxx |1 +
 include/vcl/font/Feature.hxx  |7 +--
 vcl/source/font/Feature.cxx   |7 ++-
 vcl/source/font/FeatureCollector.cxx  |8 ++--
 5 files changed, 40 insertions(+), 13 deletions(-)

New commits:
commit 36eb092bed8528eaca295d817ec77fc9a2b73339
Author: Martin Hosken 
AuthorDate: Mon Mar 25 13:44:10 2019 +0700
Commit: Martin Hosken 
CommitDate: Tue Mar 26 05:00:33 2019 +0100

Allow irregular feature value structures in feature dialog

Change-Id: I92df2d47bebb0b0af38f3527881ac65a11d1bb98
Reviewed-on: https://gerrit.libreoffice.org/69643
Tested-by: Jenkins
Reviewed-by: Martin Hosken 

diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx 
b/cui/source/dialogs/FontFeaturesDialog.cxx
index b4dd8e7fc63e..27b7b18620d2 100644
--- a/cui/source/dialogs/FontFeaturesDialog.cxx
+++ b/cui/source/dialogs/FontFeaturesDialog.cxx
@@ -34,11 +34,20 @@ FontFeaturesDialog::FontFeaturesDialog(weld::Window* 
pParent, OUString const& rF
 
 FontFeaturesDialog::~FontFeaturesDialog() {}
 
-static void makeEnumComboBox(weld::ComboBox& rNameBox,
- vcl::font::FeatureDefinition const& 
rFeatureDefinition)
+static sal_Int32 makeEnumComboBox(weld::ComboBox& rNameBox,
+  vcl::font::FeatureDefinition const& 
rFeatureDefinition,
+  uint32_t nDefault)
 {
+sal_Int32 nRes = 0;
+int count = 0;
 for (vcl::font::FeatureParameter const& rParameter : 
rFeatureDefinition.getEnumParameters())
-rNameBox.append_text(rParameter.getDescription());
+{
+rNameBox.append(OUString::number(rParameter.getCode()), 
rParameter.getDescription());
+if (rParameter.getCode() == nDefault)
+nRes = count;
+++count;
+}
+return nRes;
 }
 
 void FontFeaturesDialog::initialize()
@@ -94,9 +103,12 @@ void 
FontFeaturesDialog::fillGrid(std::vector const& rFontFe
 uint32_t nValue = 0;
 if (aExistingFeatures.find(nFontFeatureCode) != 
aExistingFeatures.end())
 nValue = aExistingFeatures.at(nFontFeatureCode);
+else
+nValue = aDefinition.getDefault();
 
 FontFeatureItem& aCurrentItem = m_aFeatureItems.back();
 aCurrentItem.m_aFeatureCode = nFontFeatureCode;
+aCurrentItem.m_nDefault = aDefinition.getDefault();
 
 sal_Int32 nGridPositionX = (i % 2) * 2;
 sal_Int32 nGridPositionY = i / 2;
@@ -113,9 +125,9 @@ void 
FontFeaturesDialog::fillGrid(std::vector const& rFontFe
 aCurrentItem.m_xText->set_label(aDefinition.getDescription());
 aCurrentItem.m_xText->show();
 
-makeEnumComboBox(*aCurrentItem.m_xCombo, aDefinition);
+sal_Int32 nInit = makeEnumComboBox(*aCurrentItem.m_xCombo, 
aDefinition, nValue);
 
-aCurrentItem.m_xCombo->set_active(nValue);
+aCurrentItem.m_xCombo->set_active(nInit);
 aCurrentItem.m_xCombo->connect_changed(aComboBoxSelectHandler);
 aCurrentItem.m_xCombo->show();
 }
@@ -166,7 +178,7 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
 {
 if (rItem.m_xCheck->get_visible())
 {
-if (rItem.m_xCheck->get_active())
+if (sal_uInt32(rItem.m_xCheck->get_active()) != rItem.m_nDefault)
 {
 if (!bFirst)
 sNameSuffix.append(OUString(vcl::font::FeatureSeparator));
@@ -174,12 +186,14 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
 bFirst = false;
 
 
sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode));
+if (!rItem.m_xCheck->get_active())
+sNameSuffix.append("=0");
 }
 }
 else if (rItem.m_xCombo->get_visible() && rItem.m_xText->get_visible())
 {
-int nSelection = rItem.m_xCombo->get_active();
-if (nSelection > 0)
+sal_Int32 nSelection = rItem.m_xCombo->get_active_id().toInt32();
+if (nSelection != int(rItem.m_nDefault))
 {
 if (!bFirst)
 sNameSuffix.append(OUString(vcl::font::FeatureSeparator));
diff --git a/cui/source/inc/FontFeaturesDialog.hxx 
b/cui/source/inc/FontFeaturesDialog.hxx
index ccecb1fcbcbd..b8c48ce805bc 100644
--- a/cui/source/inc/FontFeaturesDialog.hxx
+++ b/cui/source/inc/FontFeaturesDialog.hxx
@@ -33,6 +33,7 @@ struct FontFeatureItem
 }
 
 sal_uInt32 m_aFeatureCode;
+sal_uInt32 m_nDefault;
 std::unique_ptr m_xBuilder;
 std::unique_ptr m_xContainer;
 std::unique_ptr m_xText;
diff --git a/include/vcl/font/Feature.hxx b/include/vcl/font/Feature.hxx
index 4709

Updating graphite

2018-12-12 Thread Martin Hosken
Dear Someone nice,

Any chance anyone could update the Graphite being used form 1.3.10 to the 
latest 1.3.12. There was a subtle behavioural change in 1.3.11 which wasn't 
reflected in the changelog (sorry) that it would be nice to get. And 1.3.12 
brings in the latest hardening, which is always a nice thing to have.

https://github.com/silnrsi/graphite/releases/download/1.3.12/graphite2-minimal-1.3.12.tgz
https://github.com/silnrsi/graphite/releases/download/1.3.12/graphite2-1.3.12.sha1sum

TIA,
Martin Hosken.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/source

2017-11-14 Thread Martin Hosken
 sw/source/core/text/itradj.cxx  |   11 ---
 sw/source/core/text/portxt.cxx  |3 ++-
 sw/source/core/txtnode/fntcache.cxx |9 ++---
 3 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 0a03336a68701f592f563538f70bb3465808c644
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Tue Nov 14 15:20:31 2017 +0700

Only do kashida insertion with fonts that have non-zero width kashidas

Change-Id: I54f51432531072a8ec3cde832003369b23cb6eaf
Reviewed-on: https://gerrit.libreoffice.org/44723
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 08c6938028b3..0c39304900ac 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -112,6 +112,9 @@ void SwTextAdjuster::FormatBlock( )
 static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& 
rInf, SwTextIter& rItr,
 sal_Int32& rKashidas, sal_Int32& nGluePortion )
 {
+if ( rInf.GetOut()->GetMinKashida() <= 0 )
+return false;
+
 // i60594 validate Kashida justification
 sal_Int32 nIdx = rItr.GetStart();
 sal_Int32 nEnd = rItr.GetEnd();
@@ -148,12 +151,6 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, 
SwTextSizeInfo& rInf,
 sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, 
nIdx, nNext - nIdx );
 if (nKashidasInAttr > 0)
 {
-// Kashida glyph looks suspicious, skip Kashida justification
-if ( rInf.GetOut()->GetMinKashida() <= 0 )
-{
-return false;
-}
-
 sal_Int32 nKashidasDropped = 0;
 if ( !SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - 
nIdx ) )
 {
@@ -211,7 +208,7 @@ static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, 
SwTextSizeInfo& rInf, SwT
 sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, 
nIdx, nNext - nIdx );
 
 long nFontMinKashida = rInf.GetOut()->GetMinKashida();
-if ( nFontMinKashida && nKashidasInAttr > 0 && 
SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - nIdx ) )
+if ( nKashidasInAttr > 0 && SwScriptInfo::IsArabicText( 
rInf.GetText(), nIdx, nNext - nIdx ) )
 {
 sal_Int32 nKashidasDropped = 0;
 while ( rKashidas && nGluePortion && nKashidasInAttr > 0 &&
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index bcdd4772cd31..da605c53de7f 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -112,7 +112,8 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo , 
const OUString* pStr,
 // Kashida Justification: Insert Kashidas
 if ( nEnd > nPos && pSI && COMPLEX == nScript )
 {
-if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && 
pSI->CountKashida() )
+if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && 
rInf.GetOut()->GetMinKashida()
+&& pSI->CountKashida() )
 {
 const sal_Int32 nKashRes = pSI->KashidaJustify( nullptr, nullptr, 
nPos, nEnd - nPos );
 // i60591: need to check result of KashidaJustify
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 8617a3b80db4..f7b055bccb65 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1254,7 +1254,8 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 // Kashida Justification
 if ( SwFontScript::CTL == nActual && nSpaceAdd )
 {
-if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() ) )
+if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() )
+&& rInf.GetOut().GetMinKashida() )
 {
 if ( pSI && pSI->CountKashida() &&
 pSI->KashidaJustify( pKernArray.get(), nullptr, 
rInf.GetIdx(),
@@ -1458,7 +1459,8 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 // Kashida Justification
 if ( SwFontScript::CTL == nActual && nSpaceAdd )
 {
-if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() ) )
+if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() )
+&& rInf.GetOut().GetMinKashida() )
 {
 if ( pSI && pSI->CountKashida() &&
  pSI->KashidaJustify( pKern

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

2017-11-14 Thread Martin Hosken
 sw/source/core/text/itradj.cxx  |   11 ---
 sw/source/core/text/portxt.cxx  |3 ++-
 sw/source/core/txtnode/fntcache.cxx |9 ++---
 3 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit c45b23377bb2fe44c26f1287ff38495344e4ca50
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Tue Nov 14 15:20:31 2017 +0700

Only do kashida insertion with fonts that have non-zero width kashidas

Change-Id: I54f51432531072a8ec3cde832003369b23cb6eaf
Reviewed-on: https://gerrit.libreoffice.org/44704
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index f82a3f6d1df2..29ee5e81a438 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -112,6 +112,9 @@ void SwTextAdjuster::FormatBlock( )
 static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& 
rInf, SwTextIter& rItr,
 sal_Int32& rKashidas, sal_Int32& nGluePortion )
 {
+if ( rInf.GetOut()->GetMinKashida() <= 0 )
+return false;
+
 // i60594 validate Kashida justification
 sal_Int32 nIdx = rItr.GetStart();
 sal_Int32 nEnd = rItr.GetEnd();
@@ -148,12 +151,6 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, 
SwTextSizeInfo& rInf,
 sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, 
nIdx, nNext - nIdx );
 if (nKashidasInAttr > 0)
 {
-// Kashida glyph looks suspicious, skip Kashida justification
-if ( rInf.GetOut()->GetMinKashida() <= 0 )
-{
-return false;
-}
-
 sal_Int32 nKashidasDropped = 0;
 if ( !SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - 
nIdx ) )
 {
@@ -211,7 +208,7 @@ static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, 
SwTextSizeInfo& rInf, SwT
 sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, 
nIdx, nNext - nIdx );
 
 long nFontMinKashida = rInf.GetOut()->GetMinKashida();
-if ( nFontMinKashida && nKashidasInAttr > 0 && 
SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - nIdx ) )
+if ( nKashidasInAttr > 0 && SwScriptInfo::IsArabicText( 
rInf.GetText(), nIdx, nNext - nIdx ) )
 {
 sal_Int32 nKashidasDropped = 0;
 while ( rKashidas && nGluePortion && nKashidasInAttr > 0 &&
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index d541607b64a0..7ffc17e970fb 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -112,7 +112,8 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo , 
const OUString* pStr,
 // Kashida Justification: Insert Kashidas
 if ( nEnd > nPos && pSI && COMPLEX == nScript )
 {
-if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && 
pSI->CountKashida() )
+if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && 
rInf.GetOut()->GetMinKashida()
+&& pSI->CountKashida() )
 {
 const sal_Int32 nKashRes = pSI->KashidaJustify( nullptr, nullptr, 
nPos, nEnd - nPos );
 // i60591: need to check result of KashidaJustify
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 6bca3c4c8a52..c7ab996bf40b 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1248,7 +1248,8 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 // Kashida Justification
 if ( SwFontScript::CTL == nActual && nSpaceAdd )
 {
-if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() ) )
+if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() )
+&& rInf.GetOut().GetMinKashida() )
 {
 if ( pSI && pSI->CountKashida() &&
 pSI->KashidaJustify( pKernArray.get(), nullptr, 
rInf.GetIdx(),
@@ -1452,7 +1453,8 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 // Kashida Justification
 if ( SwFontScript::CTL == nActual && nSpaceAdd )
 {
-if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() ) )
+if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() )
+&& rInf.GetOut().GetMinKashida() )
 {
 if ( pSI && pSI->CountKashida() &&
  pSI->KashidaJustify( pKern

Awami Nastaliq and LibreOffice for Pakistan

2017-07-21 Thread Martin Hosken
Dear All,

I realise this is a bit of a sales pitch, but it's a mutual benefit pitch.

SIL's Awami Nastaliq font has just been released 
http://software.sil.org/awami/release-1-000. This is a nastaliq Arabic font 
that, in combination with LibreOffice (since it's Graphite only) makes 
LibreOffice the most powerful accessible word processing system for not just 
Urdu but all the languages of Pakistan that use nastaliq.

So if you are of know of users in that region, please let them know that they 
now have the capability to produce nice looking text for free!

BTW the font also works in FireFox. So you can put up webpages with it too.

Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: i18nlangtag/qa i18nlangtag/source include/i18nlangtag officecfg/registry svtools/source

2016-11-17 Thread Martin Hosken
 i18nlangtag/qa/cppunit/test_languagetag.cxx  |   12 ++
 i18nlangtag/source/isolang/mslangid.cxx  |   26 -
 i18nlangtag/source/languagetag/languagetag.cxx   |   45 +++
 include/i18nlangtag/languagetag.hxx  |   24 
 officecfg/registry/schema/org/openoffice/VCL.xcs |   20 ++
 svtools/source/misc/langtab.cxx  |   26 +
 6 files changed, 152 insertions(+), 1 deletion(-)

New commits:
commit 6b35e804198ac45386805e80a3d413ed3405c3b4
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Wed Nov 16 00:53:59 2016 +

Fix tdf#103855 add language codes and names to language lists from 
extensions

Rationale for changes to languagetag.hxx can be found in the bug
tdf#103855.

Change-Id: I7fa7c8a3f7b219ce08df69a3965f544ae156beab
Reviewed-on: https://gerrit.libreoffice.org/30882
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx 
b/i18nlangtag/qa/cppunit/test_languagetag.cxx
index 74d93cc..c7a8001 100644
--- a/i18nlangtag/qa/cppunit/test_languagetag.cxx
+++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx
@@ -23,6 +23,7 @@
 #include 
 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -518,6 +519,17 @@ void TestLanguageTag::testAllTags()
 CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( qty.getLanguageType()) );
 }
 
+// 'qtx' is an unknown new mslangid
+{
+OUString s_qtx( "qtx" );
+LanguageTag qtx( s_qtx );
+qtx.setScriptType( LanguageTag::ScriptType::RTL );
+LanguageType n_qtx = qtx.getLanguageType();
+CPPUNIT_ASSERT_EQUAL( MsLangId::getScriptType(n_qtx), 
css::i18n::ScriptType::COMPLEX );
+CPPUNIT_ASSERT( MsLangId::isRightToLeft(n_qtx) );
+CPPUNIT_ASSERT( !MsLangId::isCJK(n_qtx) );
+}
+
 // 'x-comment' is a privateuse known "locale"
 {
 OUString s_xcomment( "x-comment" );
diff --git a/i18nlangtag/source/isolang/mslangid.cxx 
b/i18nlangtag/source/isolang/mslangid.cxx
index 71535d6..280d21f 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -230,6 +230,8 @@ bool MsLangId::isRightToLeft( LanguageType nLang )
 default:
 break;
 }
+if (LanguageTag::isOnTheFlyID(nLang))
+return LanguageTag::getOnTheFlyScriptType(nLang) == 
LanguageTag::ScriptType::RTL;
 return false;
 }
 
@@ -303,6 +305,8 @@ bool MsLangId::isCJK( LanguageType nLang )
 default:
 break;
 }
+if (LanguageTag::isOnTheFlyID(nLang))
+return LanguageTag::getOnTheFlyScriptType(nLang) == 
LanguageTag::ScriptType::CJK;
 return false;
 }
 
@@ -340,6 +344,7 @@ bool MsLangId::needsSequenceChecking( LanguageType nLang )
 sal_Int16 MsLangId::getScriptType( LanguageType nLang )
 {
 sal_Int16 nScript;
+
 switch( nLang )
 {
 // CTL
@@ -429,7 +434,26 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang )
 // Western (actually not necessarily Latin but also Cyrillic,
 // for example)
 default:
-nScript = css::i18n::ScriptType::LATIN;
+if (LanguageTag::isOnTheFlyID(nLang))
+{
+switch (LanguageTag::getOnTheFlyScriptType(nLang))
+{
+case LanguageTag::ScriptType::CJK :
+nScript = css::i18n::ScriptType::ASIAN;
+break;
+case LanguageTag::ScriptType::CTL :
+case LanguageTag::ScriptType::RTL :
+nScript = css::i18n::ScriptType::COMPLEX;
+break;
+case LanguageTag::ScriptType::WESTERN :
+case LanguageTag::ScriptType::UNKNOWN :
+default:
+nScript = css::i18n::ScriptType::LATIN;
+break;
+}
+}
+else
+nScript = css::i18n::ScriptType::LATIN;
 }
 break;
 }
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx 
b/i18nlangtag/source/languagetag/languagetag.cxx
index f87fe58..899ee5f 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -267,6 +267,7 @@ private:
 mutable OUStringmaCachedVariants;   ///< cache 
getVariants()
 mutable lt_tag_t*   mpImplLangtag;  ///< 
liblangtag pointer
 mutable LanguageTypemnLangID;
+mutable LanguageTag::ScriptType meScriptType;
 mutable D

Graphite release

2016-11-11 Thread Martin Hosken
Dear All,

I've just released the latest version of the Graphite engine, which I hope will 
stand for a good long while. Please could someone upload it and add the 
necessary entry to downloads.lst. The file can be downloaded from here:

https://github.com/silnrsi/graphite/releases/download/1.3.9/graphite2-minimal-1.3.9.tgz

and the line in downloads.lst would change from:

export GRAPHITE_TARBALL := 
4311dd9ace498b57c85f611e0670df64-graphite2-minimal-1.3.8.tgz

to:

export GRAPHITE_TARBALL := 
3069842a88b8f40c6b83ad2850cda293-graphite2-minimal-1.3.9.tgz

TIA,
Yours,
Martin

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'feature/commonsallayout' - vcl/inc vcl/source

2016-10-17 Thread Martin Hosken
 vcl/inc/CommonSalLayout.hxx|4 ++
 vcl/source/gdi/CommonSalLayout.cxx |   53 +++--
 2 files changed, 55 insertions(+), 2 deletions(-)

New commits:
commit 36d52726e5b496d8f2d2857bb74489a1bed90a1e
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Mon Oct 17 15:22:32 2016 +0100

Add feature support to CommonLayout

Change-Id: I19a0e26cefa5e4185df961ae0f6f2f37811ae5bb
Reviewed-on: https://gerrit.libreoffice.org/29978
Reviewed-by: Khaled Hosny <khaledho...@eglug.org>
Tested-by: Khaled Hosny <khaledho...@eglug.org>

diff --git a/vcl/inc/CommonSalLayout.hxx b/vcl/inc/CommonSalLayout.hxx
index 513d2b9..abc5ea7 100644
--- a/vcl/inc/CommonSalLayout.hxx
+++ b/vcl/inc/CommonSalLayout.hxx
@@ -50,6 +50,9 @@ class CommonSalLayout : public GenericSalLayout
 #else
 ServerFont& mrServerFont;
 #endif
+OString mLang;
+hb_feature_t * mpFeatures;
+unsigned int mnFeats;
 
 public:
 #if defined(_WIN32)
@@ -63,6 +66,7 @@ public:
 const ServerFont&   getFontData() const { return mrServerFont; };
 #endif
 
+voidParseFeatures(OUString name);
 voidSetNeedFallback(ImplLayoutArgs&, sal_Int32, bool);
 voidAdjustLayout(ImplLayoutArgs&) override;
 boolLayoutText(ImplLayoutArgs&) override;
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 9eb69b5..0966b29 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -126,6 +126,52 @@ static hb_unicode_funcs_t* getUnicodeFuncs()
 }
 #endif
 
+void CommonSalLayout::ParseFeatures(OUString name)
+{
+mnFeats = 0;
+mpFeatures = 0;
+mLang = OString("");
+int nStart = name.indexOf(':');
+if (nStart < 0)
+return;
+OString oName = OUStringToOString(name, RTL_TEXTENCODING_ASCII_US);
+for (int nNext = nStart; nNext > 0; nNext = name.indexOf('&', nNext + 1))
+{
+if (name.match("lang=", nNext+1))
+{
+int endamp = name.indexOf('&', nNext+1);
+int enddelim = name.indexOf(' ', nNext+1);
+int end = name.getLength();
+if (endamp < 0)
+{
+if (enddelim > 0)
+end = enddelim;
+}
+else if (enddelim < 0 || endamp < enddelim)
+end = endamp;
+else
+end = enddelim;
+mLang = oName.copy(nNext+6, end-nNext-6);
+}
+else
+++mnFeats;
+}
+if (mnFeats == 0)
+return;
+
+mpFeatures = new hb_feature_t[mnFeats];
+mnFeats = 0;
+for (int nThis = nStart, nNext = name.indexOf('&', nStart+1); nThis > 0; 
nThis = nNext, nNext = name.indexOf('&', nNext + 1))
+{
+if (!name.match("lang=", nThis+1))
+{
+int end = nNext > 0 ? nNext : name.getLength();
+if (hb_feature_from_string(oName.getStr() + nThis + 1, end - nThis 
- 1, [mnFeats]))
+++mnFeats;
+}
+}
+}
+
 #if defined(_WIN32)
 CommonSalLayout::CommonSalLayout(WinSalGraphics* WSL, WinFontInstance& 
rWinFontInstance, const WinFontFace& rWinFontFace)
 :   mhFont((HFONT)GetCurrentObject(WSL->getHDC(), OBJ_FONT)),
@@ -155,6 +201,7 @@ CommonSalLayout::CommonSalLayout(WinSalGraphics* WSL, 
WinFontInstance& rWinFontI
 }
 
 scaleHbFont(mpHbFont, mrFontSelData);
+ParseFeatures(mrFontSelData.maTargetName);
 }
 
 void CommonSalLayout::InitFont() const
@@ -186,6 +233,7 @@ CommonSalLayout::CommonSalLayout(const CoreTextStyle& 
rCoreTextStyle)
 }
 
 scaleHbFont(mpHbFont, mrFontSelData);
+ParseFeatures(mrFontSelData.maTargetName);
 }
 
 #else
@@ -205,6 +253,7 @@ CommonSalLayout::CommonSalLayout(ServerFont& rServerFont)
 }
 
 scaleHbFont(mpHbFont, mrFontSelData);
+ParseFeatures(mrFontSelData.maTargetName);
 }
 #endif
 
@@ -416,7 +465,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 // hb_language_from_string() accept ISO639-3 language tag except 
for Chinese.
 LanguageTag  = rArgs.maLanguageTag;
-OString sLanguage = OUStringToOString(rTag.getBcp47(), 
RTL_TEXTENCODING_ASCII_US);
+OString sLanguage = mLang.getLength() ? mLang : 
OUStringToOString(rTag.getBcp47(), RTL_TEXTENCODING_ASCII_US);
 
 bool bVertical = false;
 if ((rArgs.mnFlags & SalLayoutFlags::Vertical) &&
@@ -449,7 +498,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 #if HB_VERSION_ATLEAST(0, 9, 42)
 hb_buffer_set_cluster_level(pHbBuffer, 
HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
 #endif
-hb_shape(mpHbFont, pHbBuffer, nullptr, 0);
+hb_shape(mpHbFont, pHbBuffer, mpFeatures, mnFeats);
 
   

[Libreoffice-commits] core.git: external/icu

2016-04-18 Thread Martin Hosken
 external/icu/UnpackedTarball_icu.mk |3 +++
 external/icu/khmerbreakengine.patch |   24 
 2 files changed, 15 insertions(+), 12 deletions(-)

New commits:
commit 4e066825d43400969041669c82d8a4e0bfd91adf
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Fri Apr 15 20:26:08 2016 +0200

reactivate ICU Khmer patch

Patch has been upstreamed with
https://ssl.icu-project.org/trac/ticket/12504

Change-Id: I1f3ddad87a2a6568ced3f9d2b2df3e0af0ee18aa
Reviewed-on: https://gerrit.libreoffice.org/24117
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/external/icu/UnpackedTarball_icu.mk 
b/external/icu/UnpackedTarball_icu.mk
index c48d025..4a6a114 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -27,6 +27,9 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
external/icu/clang-cl.patch.0 \
$(if $(filter-out 
ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.diff) \
$(if $(filter EMSCRIPTEN,$(OS)),external/icu/icu4c-emscripten.patch.1) \
+   external/icu/khmerbreakengine.patch \
 ))
 
+$(eval $(call 
gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/icu/khmerbreakengine.patch 
b/external/icu/khmerbreakengine.patch
index 0687645..8f81f31 100644
--- a/external/icu/khmerbreakengine.patch
+++ b/external/icu/khmerbreakengine.patch
@@ -478,9 +478,9 @@ index f1c874d..3ad1b3f 100644
 -UChar32 uc;
 -int32_t chars = 0;
 -for (;;) {
--int32_t pcIndex = utext_getNativeIndex(text);
+-int32_t pcIndex = (int32_t)utext_getNativeIndex(text);
 -pc = utext_next32(text);
--int32_t pcSize = utext_getNativeIndex(text) - pcIndex;
+-int32_t pcSize = (int32_t)utext_getNativeIndex(text) - 
pcIndex;
 -chars += pcSize;
 -remaining -= pcSize;
 -if (remaining <= 0) {
@@ -1000,10 +1000,10 @@ index cb594c6..82f2e77 100644
 +int32_t *prefix, UnicodeSet const* ignoreSet, 
int32_t minLength) const {
  
  UCharsTrie uct(characters);
- int32_t startingTextIndex = utext_getNativeIndex(text);
+ int32_t startingTextIndex = (int32_t)utext_getNativeIndex(text);
 @@ -53,7 +53,13 @@ int32_t UCharsDictionaryMatcher::matches(UText *text, 
int32_t maxLength, int32_t
  UStringTrieResult result = (codePointsMatched == 0) ? uct.first(c) : 
uct.next(c);
- int32_t lengthMatched = utext_getNativeIndex(text) - 
startingTextIndex;
+ int32_t lengthMatched = (int32_t)utext_getNativeIndex(text) - 
startingTextIndex;
  codePointsMatched += 1;
 +if (ignoreSet != NULL && ignoreSet->contains(c)) {
 +continue;
@@ -1022,11 +1022,11 @@ index cb594c6..82f2e77 100644
 -int32_t *prefix) const {
 +int32_t *prefix, UnicodeSet const* ignoreSet, 
int32_t minLength) const {
  BytesTrie bt(characters);
- int32_t startingTextIndex = utext_getNativeIndex(text);
+ int32_t startingTextIndex = (int32_t)utext_getNativeIndex(text);
  int32_t wordCount = 0;
 @@ -120,7 +126,13 @@ int32_t BytesDictionaryMatcher::matches(UText *text, 
int32_t maxLength, int32_t
  UStringTrieResult result = (codePointsMatched == 0) ? 
bt.first(transform(c)) : bt.next(transform(c));
- int32_t lengthMatched = utext_getNativeIndex(text) - 
startingTextIndex;
+ int32_t lengthMatched = (int32_t)utext_getNativeIndex(text) - 
startingTextIndex;
  codePointsMatched += 1;
 +if (ignoreSet != NULL && ignoreSet->contains(c)) {
 +continue;
@@ -1081,7 +1081,7 @@ diff --git a/source/data/Makefile.in 
b/source/data/Makefile.in
 index 816c82d..c637d70 100644
 --- misc/icu/source/data/Makefile.in
 +++ build/icu/source/data/Makefile.in
-@@ -179,7 +179,7 @@ endif
+@@ -181,7 +181,7 @@ endif
  endif
  endif
  
@@ -1090,17 +1090,17 @@ index 816c82d..c637d70 100644
  ifneq ($(ENABLE_STATIC),)
  ifeq ($(PKGDATA_MODE),dll)
$(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) 
-p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) -m static $(PKGDATA_VERSIONING) 
$(PKGDATA_LIST)
-@@ -563,8 +563,14 @@ $(BRKBLDDIR)/burmesedict.dict: 
$(TOOLBINDIR)/gendict$(TOOLEXEEXT) $(DAT_FILES)
-   $(INVOKE) $(TOOLBINDIR)/gendict --bytes --transform offset-0x1000 -c -i 
$(BUILDDIR) $(BRKSRCDIR)/burmesedict.txt $(BRKBLDDIR)/burmesedict.dict
+@@ -564,8 +564,14 @@ $(BRKBLDDIR)/burmesedict.dict: 
$(TOOLBINDIR)/gendict$(TOOLEXEEXT) $(DAT_FILES)
+   $(INVOKE) $(TOOLBINDIR)/gendict --bytes --

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

2016-03-31 Thread Martin Hosken
 download.lst  |2 +-
 external/graphite/ubsan.patch |   11 ---
 2 files changed, 1 insertion(+), 12 deletions(-)

New commits:
commit 2973476aac4a7bde6c17b93808a258fd205b8f37
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Fri Apr 1 11:17:30 2016 +0700

Fix up upgrade to graphite 1.3.8

Change-Id: Idd7945176e1f667c29ff11144dc78870110bf562
Reviewed-on: https://gerrit.libreoffice.org/23716
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/download.lst b/download.lst
index 7ba8351..8d6eed1 100644
--- a/download.lst
+++ b/download.lst
@@ -56,7 +56,7 @@ export FREETYPE_TARBALL := 
dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.b
 export GLEW_TARBALL := 3941e9cab2f4f9d8faee3e8d57ae7664-glew-1.12.0.zip
 export GLM_TARBALL := 
bae83fa5dc7f081768daace6e199adc3-glm-0.9.4.6-libreoffice.zip
 export GLYPHY_TARBALL := 5d303fb955beb9bf112267316ca9d021-glyphy-0.2.0.tar.bz2
-export GRAPHITE_TARBALL := 
17df8301bcc459e83f8a8f3aca6183b2-graphite-minimal-1.3.6.tgz
+export GRAPHITE_TARBALL := 
4311dd9ace498b57c85f611e0670df64-graphite2-minimal-1.3.8.tgz
 export HARFBUZZ_MD5SUM := 0e27e531f4c4acff601ebff0957755c2
 export HARFBUZZ_TARBALL := harfbuzz-0.9.40.tar.bz2
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
diff --git a/external/graphite/ubsan.patch b/external/graphite/ubsan.patch
index b1617b1..2f3bf5e 100644
--- a/external/graphite/ubsan.patch
+++ b/external/graphite/ubsan.patch
@@ -1,14 +1,3 @@
 src/Pass.cpp
-+++ src/Pass.cpp
-@@ -294,7 +294,7 @@
- s->rules = begin;
- s->rules_end = (end - begin <= FiniteStateMachine::MAX_RULES)? end :
- begin + FiniteStateMachine::MAX_RULES;
--qsort(begin, end - begin, sizeof(RuleEntry), );
-+if (end != begin) qsort(begin, end - begin, sizeof(RuleEntry), 
);
- }
- 
- return true;
 --- src/gr_face.cpp
 +++ src/gr_face.cpp
 @@ -87,7 +87,7 @@
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: external/icu

2016-03-21 Thread Martin Hosken
 external/icu/khmerbreakengine.patch |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 7f36f4ce9f9f3d430009ba472d275d038abecb16
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Tue Mar 22 11:26:52 2016 +0700

Fix wrong pattern definitions in khmer dictionary breaker

Change-Id: I0132196744046391759a6e5110d054feee3deea3
Reviewed-on: https://gerrit.libreoffice.org/23420
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/external/icu/khmerbreakengine.patch 
b/external/icu/khmerbreakengine.patch
index bc0d287..0687645 100644
--- a/external/icu/khmerbreakengine.patch
+++ b/external/icu/khmerbreakengine.patch
@@ -15,8 +15,8 @@ index f1c874d..3ad1b3f 100644
 +fViramaSet.applyPattern(UNICODE_STRING_SIMPLE("[[:ccc=VR:]]"), status);
 +
 +// note Skip Sets contain fIgnoreSet characters too.
-+
fSkipStartSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=OP:][:lb=QU:]]\\u200C\\u200D\\u2060"),
 status);
-+
fSkipEndSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CP:][:lb=QU:][:lb=EX:][:lb=CL:]]\\u200C\\u200D\\u2060"),
 status);
++
fSkipStartSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=OP:][:lb=QU:]\\u200C\\u200D\\u2060]"),
 status);
++
fSkipEndSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CP:][:lb=QU:][:lb=EX:][:lb=CL:]\\u200C\\u200D\\u2060]"),
 status);
 +
fNBeforeSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CR:][:lb=LF:][:lb=NL:][:lb=SP:][:lb=ZW:][:lb=IS:][:lb=BA:][:lb=NS:]]"),
 status);
  }
  
@@ -332,10 +332,10 @@ index f1c874d..3ad1b3f 100644
 +startZwsp = scanBeforeStart(text, scanStart, breakStart);
 +}
 +utext_setNativeIndex(text, rangeStart);
-+scanFwdClusters(text, rangeStart, initAfter);
++scanFwdClusters(text, rangeEnd, initAfter);
 +bool endZwsp = scanAfterEnd(text, utext_nativeLength(text), scanEnd, 
breakEnd);
 +utext_setNativeIndex(text, rangeEnd - 1);
-+scanBackClusters(text, rangeEnd, finalBefore);
++scanBackClusters(text, rangeStart, finalBefore);
 +if (finalBefore < initAfter) {   // the whole run is tented so no breaks
 +if (breakStart || fTypes < UBRK_LINE)
 +foundBreaks.push(rangeStart, status);
@@ -539,7 +539,7 @@ index f1c874d..3ad1b3f 100644
 +int32_t ln = lengths.elementAti(j);
 +utext_setNativeIndex(text, ln+ix);
 +int32_t c = utext_current32(text);
-+while (fPuncSet.contains(c) || fIgnoreSet.contains(c)) {
++while ((fPuncSet.contains(c) || fIgnoreSet.contains(c)) && ln + i 
< numCodePts) {
 +++ln;
 +utext_next32(text);
 +c = utext_current32(text);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: external/icu

2016-03-19 Thread Martin Hosken
 external/icu/khmerbreakengine.patch |  327 +---
 external/icu/khmerdict.dict |binary
 2 files changed, 17 insertions(+), 310 deletions(-)

New commits:
commit a976a19ca82661d8b459b85f5514b0e4c9222d47
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Thu Mar 17 09:57:35 2016 +0700

Fix bug in khmr linebreaking and update dictionary

Change-Id: I2b776925c2c95cb56ccd592d036823c26054e059
Reviewed-on: https://gerrit.libreoffice.org/23316
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/external/icu/khmerbreakengine.patch 
b/external/icu/khmerbreakengine.patch
index ba3e392..bc0d287 100644
--- a/external/icu/khmerbreakengine.patch
+++ b/external/icu/khmerbreakengine.patch
@@ -2,7 +2,7 @@ diff --git a/source/common/dictbe.cpp b/source/common/dictbe.cpp
 index f1c874d..3ad1b3f 100644
 --- misc/icu/source/common/dictbe.cpp
 +++ build/icu/source/common/dictbe.cpp
-@@ -27,8 +27,16 @@ U_NAMESPACE_BEGIN
+@@ -27,8 +27,17 @@ U_NAMESPACE_BEGIN
   **
   */
  
@@ -14,13 +14,14 @@ index f1c874d..3ad1b3f 100644
  fTypes = breakTypes;
 +fViramaSet.applyPattern(UNICODE_STRING_SIMPLE("[[:ccc=VR:]]"), status);
 +
++// note Skip Sets contain fIgnoreSet characters too.
 +
fSkipStartSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=OP:][:lb=QU:]]\\u200C\\u200D\\u2060"),
 status);
 +
fSkipEndSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CP:][:lb=QU:][:lb=EX:][:lb=CL:]]\\u200C\\u200D\\u2060"),
 status);
 +
fNBeforeSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CR:][:lb=LF:][:lb=NL:][:lb=SP:][:lb=ZW:][:lb=IS:][:lb=BA:][:lb=NS:]]"),
 status);
  }
  
  DictionaryBreakEngine::~DictionaryBreakEngine() {
-@@ -90,7 +98,7 @@ DictionaryBreakEngine::findBreaks( UText *text,
+@@ -90,7 +99,7 @@ DictionaryBreakEngine::findBreaks( UText *text,
  result = divideUpDictionaryRange(text, rangeStart, rangeEnd, 
foundBreaks);
  utext_setNativeIndex(text, current);
  }
@@ -29,7 +30,7 @@ index f1c874d..3ad1b3f 100644
  return result;
  }
  
-@@ -101,6 +109,163 @@ DictionaryBreakEngine::setCharacters( const UnicodeSet 
 ) {
+@@ -101,6 +110,169 @@ DictionaryBreakEngine::setCharacters( const UnicodeSet 
 ) {
  fSet.compact();
  }
  
@@ -87,6 +88,8 @@ index f1c874d..3ad1b3f 100644
 +}
 +for (int i = 0; i < clusterLimit; ++i) { // scan backwards clusterLimit 
clusters
 +while (start > textStart) {
++while (fIgnoreSet.contains(c))
++c = utext_previous32(text);
 +if (!fMarkSet.contains(c)) {
 +if (fBaseSet.contains(c)) {
 +c = utext_previous32(text);
@@ -125,6 +128,10 @@ index f1c874d..3ad1b3f 100644
 +++end;
 +}
 +for (int i = 0; i < clusterLimit; ++i) { // scan forwards clusterLimit 
clusters
++while (fIgnoreSet.contains(c)) {
++utext_next32(text);
++c = utext_current32(text);
++}
 +if (fBaseSet.contains(c)) {
 +while (end < textEnd) {
 +utext_next32(text);
@@ -193,7 +200,7 @@ index f1c874d..3ad1b3f 100644
  /*
   **
   * PossibleWord
-@@ -128,35 +293,35 @@ private:
+@@ -128,35 +302,35 @@ private:
  public:
  PossibleWord() : count(0), prefix(0), offset(-1), mark(0), current(0) {};
  ~PossibleWord() {};
@@ -238,242 +245,7 @@ index f1c874d..3ad1b3f 100644
  // Dictionary leaves text after longest prefix, not longest word. 
Back up.
  if (count <= 0) {
  utext_setNativeIndex(text, start);
-@@ -261,16 +426,16 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
- int32_t current;
- UErrorCode status = U_ZERO_ERROR;
- PossibleWord words[THAI_LOOKAHEAD];
--
-+
- utext_setNativeIndex(text, rangeStart);
--
-+
- while (U_SUCCESS(status) && (current = 
(int32_t)utext_getNativeIndex(text)) < rangeEnd) {
- cpWordLength = 0;
- cuWordLength = 0;
- 
- // Look for candidate words at the current position
- int32_t candidates = 
words[wordsFound%THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
--
-+
- // If we found exactly one, use that
- if (candidates == 1) {
- cuWordLength = words[wordsFound % 
THAI_LOOKAHEAD].acceptMarked(text);
-@@ -291,12 +456,12 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
- words[wordsFound%THAI_LOOKAHEAD].markCurrent();
- wordsMatched = 2;
- }
--
-+
- // If we're already at the end of the range, we're done
- if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
- goto foundBest

Re: Windows / font / text futures ...

2016-03-09 Thread Martin Hosken
I'm replying from the digest so the thread may mess up.

So much good stuff to agree with.

I think it's clear that there is a difference between the process of getting 
glyphs on a screen (rendering) and working out which glyphs should go where at 
the run level (shaping) and at the paragraph level (layout). They each have 
their own issues.

On rendering. I don't think it matters too much which approach one takes to get 
glyphs on the screen. Freetype is nice and cross platform but may not be the 
quickest library on the shelf. Local rendering is costly to maintain but can 
give you various goodies. I'm no expert here and I get very confused when I 
look at firefox. But then I am thinking that all applications in this space are 
carrying a fair amount of legacy baggage.

Onto something I think I know more about: shaping.

As one of the poor fools who has tried to create a SalLayout subclass (for 
Graphite), I agree that the current model is very broken and just about holds 
together. The layer violations are embarrassing and confusion abounds. I agree 
that we should come up with a good API for vcl and stop sw digging around in 
the mud.

Personally, I think kashida insertion is the job of something like harfbuzz. In 
fact justification is something the font wants to get involved in (do we expand 
a ligature here? use glyph ductility here? limit the amount of inter base glyph 
here and balance it against what is given to the space, and so on and so 
fifth). Justification is too complicated to be done by the application, it 
requires too much script knowledge. Better to have the application negotiate 
with the font to allocate an overall expansion/contraction for a run and let 
the shaper do the heavy lifting from there.

harfbuzz is nice in that it provides a plugin mechanism, in effect, to allow 
other shapers to get involved, but provides a single interface for the 
application. This is good. I would be happy for harfbuzz to win the day and 
have Graphite accessed under that, so long as we do it right ;)

As to floating point. Yes there are system differences, but they are so minor 
in this game as to be completely ignorable. I took care when doing my collision 
avoidance stuff, that does lots of maths, with floats rather than doubles, and 
found that once I got the thing overall correct, the need for rounding 
management was much less than I thought and that once you take an int(aFloat) 
the differences are gone between systems. While floats are used for shaping, 
it's more to save the effort of fixed point integer maths which is fiddly and 
with a modern CPU, much slower than floating point. If rounding were an issue, 
we would switch to doubles in a flash. No such need has been found.

The need for good fidelity in shaping across platforms is about line breaking, 
primarily and the results are generally good, certainly much better than native 
shaping, which almost guarantees you are going to be frustrated. I think we 
have to go with consistent shaping across all platforms if we want documents to 
have any hope of laying out the same across different platforms.

When it comes to layout, there are lots of fun things that can be done. The 
trendy direction at the moment is to implement the TeX paragraph layout 
algorithm and android has minikin which we could probably leverage to help 
there.

Why do I think we need to see change? Well, when it takes 20+ reshapings of a 
paragraph to get it onto the screen (as someone measured), one has to ask 
whether something might be wrong. Yes shaping is cheap, at least for simple 
Latin, but these things add up, and once you get onto Indic or Arabic shaping, 
they multiply up quite a long way. In the modern battery saving world, it must 
be possible to save doing quite so much redundant work?

Yes all this will take quite a lot of work to get right. The question is 
whether we have the will to make it right.

Thanks for listening!

Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-02-14 Thread Martin Hosken
 vcl/source/glyphs/graphite_layout.cxx |   35 +++---
 1 file changed, 16 insertions(+), 19 deletions(-)

New commits:
commit b073d9f2e35dd0b6cdbc66e31050250a6f34cc55
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Mon Feb 15 10:08:19 2016 +0700

Tidy up graphite layout code after fixing line ending diacritics

Change-Id: I1efafbd64539ac6d71de0be41ecaa71533143590
Reviewed-on: https://gerrit.libreoffice.org/22362
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 8226c9c..dcdd31d 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -668,27 +668,24 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs 
)
 unsigned int GraphiteLayout::ScanFwdForChar(int , bool fallback) const
 {
 int res = mvChar2Glyph[findChar - mnMinCharPos];
-int done = 3;
-while (res == -1 && --done)
+if (res >= 0)
+return unsigned(res);
+if (fallback)
 {
-if (fallback)
-{
-for (++findChar; findChar - mnMinCharPos < 
int(mvChar2Glyph.size()); ++findChar)
-if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
-return res;
---findChar;
-return mvGlyphs.size() - 1;
-}
-else
-{
-for (--findChar; findChar >= mnMinCharPos; --findChar)
-if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
-return res;
-++findChar;
-return 0;
-}
+for (++findChar; findChar - mnMinCharPos < int(mvChar2Glyph.size()); 
++findChar)
+if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
+return res;
+--findChar;
+return mvGlyphs.size() - 1;
+}
+else
+{
+for (--findChar; findChar >= mnMinCharPos; --findChar)
+if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
+return res;
+++findChar;
+return 0;
 }
-return unsigned(res);
 }
 
 void GraphiteLayout::ApplyDXArray(ImplLayoutArgs , std::vector & 
rDeltaWidth)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-02-12 Thread Martin Hosken
 vcl/source/glyphs/graphite_layout.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit f2df80410b34faa88740f2c0c2b021c74a19d5ca
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Thu Feb 11 14:05:55 2016 +0700

Fix graphite line final diacritics

Change-Id: If5175fd489e835dbf9d37a45fd266c6ce44eae1a
Reviewed-on: https://gerrit.libreoffice.org/22280
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 2405967..2038a24 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -676,12 +676,16 @@ unsigned int GraphiteLayout::ScanFwdForChar(int 
, bool fallback) const
 for (++findChar; findChar - mnMinCharPos < 
int(mvChar2Glyph.size()); ++findChar)
 if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
 return res;
+--findChar;
+return mvGlyphs.size() - 1;
 }
 else
 {
 for (--findChar; findChar >= mnMinCharPos; --findChar)
 if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
 return res;
+++findChar;
+return 0;
 }
 fallback = !fallback;
 }
@@ -693,8 +697,8 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs , 
std::vector & rDelt
 bool bRtl(mnLayoutFlags & SalLayoutFlags::BiDiRtl);
 int startChar = args.mnMinCharPos < mnMinCharPos ? mnMinCharPos : 
args.mnMinCharPos;
 int endChar = args.mnEndCharPos >= mnEndCharPos ? mnEndCharPos - 1 : 
args.mnEndCharPos;
-unsigned int startGi = ScanFwdForChar(startChar, !bRtl);
-unsigned int endGi = ScanFwdForChar(endChar, bRtl);
+unsigned int startGi = ScanFwdForChar(startChar, bRtl);
+unsigned int endGi = ScanFwdForChar(endChar, !bRtl);
 int nChars = endChar - startChar + 1;
 if (nChars <= 0) return;
 if (startGi > endGi)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: external/icu

2016-01-08 Thread Martin Hosken
 external/icu/khmerbreakengine.patch |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 39b718dd655220110523b7013e65ea4f821aedf7
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Fri Jan 8 16:41:52 2016 +0700

Fix applying external dict to icu, and khmer break engine fixes

Change-Id: Ib897e5fa5e80f75f501694dbf874aabd92253b25
Reviewed-on: https://gerrit.libreoffice.org/21247
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/external/icu/khmerbreakengine.patch 
b/external/icu/khmerbreakengine.patch
index 03e6079b..ba3e392 100644
--- a/external/icu/khmerbreakengine.patch
+++ b/external/icu/khmerbreakengine.patch
@@ -14,8 +14,8 @@ index f1c874d..3ad1b3f 100644
  fTypes = breakTypes;
 +fViramaSet.applyPattern(UNICODE_STRING_SIMPLE("[[:ccc=VR:]]"), status);
 +
-+fSkipStartSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=OP:][:lb=QU:]]"), 
status);
-+
fSkipEndSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CP:][:lb=QU:][:lb=EX:][:lb=CL:]]"),
 status);
++
fSkipStartSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=OP:][:lb=QU:]]\\u200C\\u200D\\u2060"),
 status);
++
fSkipEndSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CP:][:lb=QU:][:lb=EX:][:lb=CL:]]\\u200C\\u200D\\u2060"),
 status);
 +
fNBeforeSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CR:][:lb=LF:][:lb=NL:][:lb=SP:][:lb=ZW:][:lb=IS:][:lb=BA:][:lb=NS:]]"),
 status);
  }
  
@@ -473,7 +473,7 @@ index f1c874d..3ad1b3f 100644
  // Look ahead for possible suffixes if a dictionary word does not 
follow.
  // We do this in code rather than using a rule so that the heuristic
  // resynch continues to function. For example, one of the suffix 
characters
-@@ -828,51 +993,29 @@ foundBest:
+@@ -828,51 +993,28 @@ foundBest:
   * KhmerBreakEngine
   */
  
@@ -506,7 +506,7 @@ index f1c874d..3ad1b3f 100644
  setCharacters(fKhmerWordSet);
  }
  
fMarkSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:LineBreak=SA:]&[:M:]]"),
 status);
- fMarkSet.add(0x0020);
+-fMarkSet.add(0x0020);
 -fEndWordSet = fKhmerWordSet;
 -fBeginWordSet.add(0x1780, 0x17B3);
 -//fBeginWordSet.add(0x17A3, 0x17A4);  // deprecated vowels
@@ -522,7 +522,7 @@ index f1c874d..3ad1b3f 100644
 -//fSuffixSet.add(THAI_MAIYAMOK);
 +fIgnoreSet.add(0x2060); // WJ
 +fIgnoreSet.add(0x200C, 0x200D); // ZWJ, ZWNJ
-+fBaseSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:^M:]]"), status);
++
fBaseSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:lb=SA:]&[:^M:]]"), 
status);
 +
fPuncSet.applyPattern(UNICODE_STRING_SIMPLE("[\\u17D4\\u17D5\\u17D6\\u17D7\\u17D9:]"),
 status);
  
  // Compact for caching.
@@ -750,7 +750,7 @@ index f1c874d..3ad1b3f 100644
 -if (cuWordLength <= 0) {
 -wordsFound += 1;
 -}
-+} while (fMarkSet.contains(c));
++} while (fMarkSet.contains(c) || fIgnoreSet.contains(c));
 +values.setElementAt(BADSNLP, count);
 +lengths.setElementAt(utext_getNativeIndex(text) - currix, 
count++);
 +} else {
@@ -775,7 +775,7 @@ index f1c874d..3ad1b3f 100644
 -else {
 -// Back up to where we were for next iteration
 -utext_setNativeIndex(text, current+cuWordLength);
-+int32_t ln_j_i = ln + i;
++int32_t ln_j_i = ln + i;   // yes really i!
 +if (newSnlp < bestSnlp.elementAti(ln_j_i)) {
 +if (v == BADSNLP) {
 +int32_t p = prev.elementAti(i);
@@ -1395,7 +1395,7 @@ index 816c82d..c637d70 100644
 +#$(MAINBUILDDIR)/khmerdict.stamp: $(TOOLBINDIR)/gendict$(TOOLEXEEXT) 
$(BRKSRCDIR)/khmerdict.txt build-local
 +# $(INVOKE) $(TOOLBINDIR)/gendict --bytes --transform offset-0x1780 -c -i 
$(BUILDDIR) $(BRKSRCDIR)/khmerdict.txt $(BRKBLDDIR)/khmerdict.dict
 +$(MAINBUILDDIR)/khmerdict.stamp: $(BRKSRCDIR)/khmerdict.dict build-local
-+  cp $< $(MAINBUILDDIR)
++  cp $< $(BRKBLDDIR)
 +  echo "timestamp" > $@
 
  CFU
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: external/icu i18npool/source

2016-01-04 Thread Martin Hosken
 external/icu/UnpackedTarball_icu.mk |3 
 external/icu/khmerbreakengine.patch | 1403 
 external/icu/khmerdict.dict |binary
 i18npool/source/breakiterator/breakiterator_unicode.cxx |2 
 4 files changed, 1407 insertions(+), 1 deletion(-)

New commits:
commit fbb00383d82da5ce375f1b034d3fb9ebdd9a8f0e
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Sat Dec 12 11:36:53 2015 +0700

Use .dict files since below the 500K limit

Change-Id: Iec71ad4918cd333f0a44d372017ecee300e3aca9
Reviewed-on: https://gerrit.libreoffice.org/20748
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/external/icu/UnpackedTarball_icu.mk 
b/external/icu/UnpackedTarball_icu.mk
index c48d025..4a6a114 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -27,6 +27,9 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
external/icu/clang-cl.patch.0 \
$(if $(filter-out 
ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.diff) \
$(if $(filter EMSCRIPTEN,$(OS)),external/icu/icu4c-emscripten.patch.1) \
+   external/icu/khmerbreakengine.patch \
 ))
 
+$(eval $(call 
gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/icu/khmerbreakengine.patch 
b/external/icu/khmerbreakengine.patch
new file mode 100644
index 000..03e6079b
--- /dev/null
+++ b/external/icu/khmerbreakengine.patch
@@ -0,0 +1,1403 @@
+diff --git a/source/common/dictbe.cpp b/source/common/dictbe.cpp
+index f1c874d..3ad1b3f 100644
+--- misc/icu/source/common/dictbe.cpp
 build/icu/source/common/dictbe.cpp
+@@ -27,8 +27,16 @@ U_NAMESPACE_BEGIN
+  **
+  */
+ 
+-DictionaryBreakEngine::DictionaryBreakEngine(uint32_t breakTypes) {
++DictionaryBreakEngine::DictionaryBreakEngine(uint32_t breakTypes) :
++clusterLimit(3)
++{
++UErrorCode status = U_ZERO_ERROR;
+ fTypes = breakTypes;
++fViramaSet.applyPattern(UNICODE_STRING_SIMPLE("[[:ccc=VR:]]"), status);
++
++fSkipStartSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=OP:][:lb=QU:]]"), 
status);
++
fSkipEndSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CP:][:lb=QU:][:lb=EX:][:lb=CL:]]"),
 status);
++
fNBeforeSet.applyPattern(UNICODE_STRING_SIMPLE("[[:lb=CR:][:lb=LF:][:lb=NL:][:lb=SP:][:lb=ZW:][:lb=IS:][:lb=BA:][:lb=NS:]]"),
 status);
+ }
+ 
+ DictionaryBreakEngine::~DictionaryBreakEngine() {
+@@ -90,7 +98,7 @@ DictionaryBreakEngine::findBreaks( UText *text,
+ result = divideUpDictionaryRange(text, rangeStart, rangeEnd, 
foundBreaks);
+ utext_setNativeIndex(text, current);
+ }
+-
++
+ return result;
+ }
+ 
+@@ -101,6 +109,163 @@ DictionaryBreakEngine::setCharacters( const UnicodeSet 
 ) {
+ fSet.compact();
+ }
+ 
++bool
++DictionaryBreakEngine::scanBeforeStart(UText *text, int32_t& start, bool 
) const {
++UErrorCode status = U_ZERO_ERROR;
++UText* ut = utext_clone(NULL, text, false, true, );
++utext_setNativeIndex(ut, start);
++UChar32 c = utext_current32(ut);
++bool res = false;
++doBreak = true;
++while (start >= 0) {
++if (!fSkipStartSet.contains(c)) {
++res = (c == ZWSP);
++break;
++}
++--start;
++c = utext_previous32(ut);
++doBreak = false;
++}
++utext_close(ut);
++return res;
++}
++
++bool
++DictionaryBreakEngine::scanAfterEnd(UText *text, int32_t textEnd, int32_t& 
end, bool ) const {
++UErrorCode status = U_ZERO_ERROR;
++UText* ut = utext_clone(NULL, text, false, true, );
++utext_setNativeIndex(ut, end);
++UChar32 c = utext_current32(ut);
++bool res = false;
++doBreak = !fNBeforeSet.contains(c);
++while (end < textEnd) {
++if (!fSkipEndSet.contains(c)) {
++res = (c == ZWSP);
++break;
++}
++++end;
++c = utext_next32(ut);
++doBreak = false;
++}
++utext_close(ut);
++return res;
++}
++
++void
++DictionaryBreakEngine::scanBackClusters(UText *text, int32_t textStart, 
int32_t& start) const {
++UChar32 c = 0;
++start = utext_getNativeIndex(text);
++while (start > textStart) {
++c = utext_previous32(text);
++--start;
++if (!fSkipEndSet.contains(c))
++break;
++}
++for (int i = 0; i < clusterLimit; ++i) { // scan backwards clusterLimit 
clusters
++while (start > textStart) {
++if (!fMarkSet.contains(c)) {
++if (fBaseSet.contains(c)) {
++c = utext_previous32(text);
++if (!fViramaSet.contains(c)) { // Virama (e.g. coeng) 
preceding base. Treat sequence as a mark
++ 

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

2015-12-11 Thread Martin Hosken
 i18npool/source/breakiterator/data/char.txt |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a3d6d9e4466f9a3d6d2c34bb8f372a5265583573
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Sat Dec 12 10:41:04 2015 +0700

New Tai Lue prevowels are now stored before

Change-Id: I0103ca0da3a39e48416617aab4372cde8be0bbab
Reviewed-on: https://gerrit.libreoffice.org/20654
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/i18npool/source/breakiterator/data/char.txt 
b/i18npool/source/breakiterator/data/char.txt
index ccc1bee..3b9f801 100644
--- a/i18npool/source/breakiterator/data/char.txt
+++ b/i18npool/source/breakiterator/data/char.txt
@@ -25,7 +25,7 @@ $SpacingMark = [\p{Grapheme_Cluster_Break = SpacingMark}];
 #   \u1A61 \u1A63 \u1A64 \u1BE7 \u1BEA-\u1BEC \u1BEE \u1BF2 \u1BF3 \uAA7B
 $IndicSpacing = [\u0903 \u093B \u093E-\u0940 \u0949-\u094C \u094E \u094F 
\u0982 \u0983 \u09BF \u09C0 \u09C7 \u09C8 \u09CB \u09CC \u0A03 \u0A3E-\u0A40 
\u0A83 \u0ABE-\u0AC0 \u0AC9 \u0ACB \u0ACC \u0B02 \u0B03 \u0B40 \u0B47 \u0B48 
\u0B4B-\u0B4C \u0BBF \u0BC1 \u0BC2 \u0BC6-\u0BC8 \u0BCA-\u0BCC \u0C01-\u0C03 
\u0C41-\u0C44 \u0C82 \u0C83 \u0CBE \u0CC0 \u0CC1 \u0CC3 \u0CC4 \u0CC7 \u0CC8 
\u0CCA \u0CCB \u0D02 \u0D03 \u0D3F \u0D40 \u0D46-\u0D48 \u0D4A-\u0D4C \u0D82 
\u0D83 \u0DD0 \u0DD1 \u0DD8-\u0DDE \u0F3E \u0F3F \u0F7F \u1923-\u1926 
\u1929-\u192B \u1930 \u1931 \u1933-\u1938 \u1A19-\u1A1B \u1B04 \u1B35 \u1B3B 
\u1B3D-\u1B41 \u1B43 \u1B44 \u1B82 \u1BA1 \u1BA6 \u1BA7 \u1BAA \u1C24-\u1C2B 
\u1C34 \u1C35 \u1CE1 \u1CF2 \uA880 \uA881 \uA8B4-\uA8C3 \uA952 \uA953 \uA983 
\uA9B4 \uA9B5 \uA9BA \uA9BB \uA9BD-\uA9C0 \uAA2F \uAA30 \uAA33 \uAA34 \uABE3 
\uABE4 \uABE6 \uABE7 \uABE9 \uABEA \uABEC \U00011000 \U00011002 \U00011082 
\U000110B0-\U000110B2 \U000110B7 \U000100B8 \U0001D166 \U0001D16D];
 # SEAsian (Thai, Lao, Burmese, Tai Lue, Tai Tham, Batak) are cluster based not 
syllable based
-$SEASpacing = [\u0E33 \u0EB3 \u1031 \u103B \u103C \u1056 \u1057 \u1084 \u17B6 
\u17BE-\u17C5 \u17C7 \u17C8 \u19B5-\u19B7 \u19BA \u1A55 \u1A57 \u1A6D-\u1A72 
\uA823 \uA824 \uA827 \uAA4D];
+$SEASpacing = [\u0E33 \u0EB3 \u1031 \u103B \u103C \u1056 \u1057 \u1084 \u17B6 
\u17BE-\u17C5 \u17C7 \u17C8 \u1A55 \u1A57 \u1A6D-\u1A72 \uA823 \uA824 \uA827 
\uAA4D];
 $BengaliLetter = [\u0985-\u09B9 \u09CE \u09DC-\u09E1 \u09F0-\u09F1];
 $BengaliSignVirama = \u09CD;
 $GujaratiLetter = [\u0A85-\u0A8C \u0A8F-\u0A90 \u0A93-\u0AB9 \u0AE0-\u0AE1];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-29 Thread Martin Hosken
 vcl/source/glyphs/graphite_layout.cxx |   25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

New commits:
commit fbad13e4c0d66e5a0e65cbd2f1c5ae88bc02f2ba
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Mon Nov 30 08:20:51 2015 +0700

Fix tdf95222, graphite justification

Change-Id: I9ea7167ca21bc18db6ed7f82fc54f3824468db4e
Reviewed-on: https://gerrit.libreoffice.org/20276
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index d10538a..cb9a962 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -27,7 +27,7 @@
 #undef NDEBUG
 #endif
 
-// #define GRLAYOUT_DEBUG 1
+//#define GRLAYOUT_DEBUG 1
 
 #include 
 #include 
@@ -602,6 +602,9 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs )
 ++nClusterCount;
 }
 }
+#ifdef GRLAYOUT_DEBUG
+fprintf(grLog(), "Expand by width %f for %ld clusters\n", 
nDeltaWidth, nClusterCount);
+#endif
 if (nClusterCount > 1)
 {
 float fExtraPerCluster = static_cast(nDeltaWidth) / 
static_cast(nClusterCount - 1);
@@ -740,25 +743,26 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs , 
std::vector & rDelt
 // calculate visual cluster widths
 if (lastChar > args.mnEndCharPos) lastChar = args.mnEndCharPos;
 if (firstChar < args.mnMinCharPos) firstChar = args.mnMinCharPos;
-long nNewClusterWidth = args.mpDXArray[lastChar - args.mnMinCharPos];
 long nOrigClusterWidth = mvCharDxs[lastChar - mnMinCharPos];
+long nNewClusterWidth = args.mpDXArray[lastChar - args.mnMinCharPos];
 long nDGlyphOrigin = 0;
-if (firstChar >= args.mnMinCharPos)
+if (firstChar > args.mnMinCharPos)
 {
-nNewClusterWidth -= args.mpDXArray[firstChar - args.mnMinCharPos];
-nOrigClusterWidth -= mvCharDxs[firstChar - mnMinCharPos];
-nDGlyphOrigin = args.mpDXArray[firstChar - args.mnMinCharPos]
-- mvCharDxs[firstChar - mnMinCharPos];
+//nNewClusterWidth -= args.mpDXArray[firstChar - 
args.mnMinCharPos];
+//nOrigClusterWidth -= mvCharDxs[firstChar - mnMinCharPos];
+nDGlyphOrigin = args.mpDXArray[firstChar - args.mnMinCharPos - 1]
+- mvCharDxs[firstChar - mnMinCharPos - 1];
 }
 
 // update visual cluster
 long nDWidth = nNewClusterWidth - nOrigClusterWidth;
 if (firstChar >= args.mnMinCharPos)
 for (int n = firstChar; n <= lastChar; ++n)
-if (mvCharDxs[n - mnMinCharPos] != -1)
-mvCharDxs[n - mnMinCharPos] += nDWidth + nDGlyphOrigin;
+if (n > mnMinCharPos && mvCharDxs[n - mnMinCharPos - 1] != -1)
+mvCharDxs[n - mnMinCharPos - 1] += nDGlyphOrigin; // + 
nDWidth;
 for (unsigned int n = i; n < nLastGlyph; n++)
-mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin + nDWidth) * (bRtl ? 
-1 : 1);
+//mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin + nDWidth) * (bRtl 
? -1 : 1);
+mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin * (bRtl ? -1 : 1);
 
 rDeltaWidth[nBaseGlyph] = nDWidth;
 #ifdef GRLAYOUT_DEBUG
@@ -771,6 +775,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs , 
std::vector & rDelt
 // Update the dx vector with the new values.
 std::copy(args.mpDXArray, args.mpDXArray + nChars,
   mvCharDxs.begin() + (args.mnMinCharPos - mnMinCharPos));
+//args.mpDXArray[0] = 0;
 #ifdef GRLAYOUT_DEBUG
 fprintf(grLog(),"ApplyDx %ld(%ld)\n", args.mpDXArray[nChars - 1], mnWidth);
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/source

2015-11-29 Thread Martin Hosken
 vcl/source/glyphs/graphite_layout.cxx |   25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

New commits:
commit 2417df71811a0ccaf5e85a0cf4054ce1f5ee8c43
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Mon Nov 30 08:20:51 2015 +0700

Fix tdf95222, graphite justification

Change-Id: I9ea7167ca21bc18db6ed7f82fc54f3824468db4e
Reviewed-on: https://gerrit.libreoffice.org/20276
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>
(cherry picked from commit fbad13e4c0d66e5a0e65cbd2f1c5ae88bc02f2ba)

diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index d10538a..cb9a962 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -27,7 +27,7 @@
 #undef NDEBUG
 #endif
 
-// #define GRLAYOUT_DEBUG 1
+//#define GRLAYOUT_DEBUG 1
 
 #include 
 #include 
@@ -602,6 +602,9 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs )
 ++nClusterCount;
 }
 }
+#ifdef GRLAYOUT_DEBUG
+fprintf(grLog(), "Expand by width %f for %ld clusters\n", 
nDeltaWidth, nClusterCount);
+#endif
 if (nClusterCount > 1)
 {
 float fExtraPerCluster = static_cast(nDeltaWidth) / 
static_cast(nClusterCount - 1);
@@ -740,25 +743,26 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs , 
std::vector & rDelt
 // calculate visual cluster widths
 if (lastChar > args.mnEndCharPos) lastChar = args.mnEndCharPos;
 if (firstChar < args.mnMinCharPos) firstChar = args.mnMinCharPos;
-long nNewClusterWidth = args.mpDXArray[lastChar - args.mnMinCharPos];
 long nOrigClusterWidth = mvCharDxs[lastChar - mnMinCharPos];
+long nNewClusterWidth = args.mpDXArray[lastChar - args.mnMinCharPos];
 long nDGlyphOrigin = 0;
-if (firstChar >= args.mnMinCharPos)
+if (firstChar > args.mnMinCharPos)
 {
-nNewClusterWidth -= args.mpDXArray[firstChar - args.mnMinCharPos];
-nOrigClusterWidth -= mvCharDxs[firstChar - mnMinCharPos];
-nDGlyphOrigin = args.mpDXArray[firstChar - args.mnMinCharPos]
-- mvCharDxs[firstChar - mnMinCharPos];
+//nNewClusterWidth -= args.mpDXArray[firstChar - 
args.mnMinCharPos];
+//nOrigClusterWidth -= mvCharDxs[firstChar - mnMinCharPos];
+nDGlyphOrigin = args.mpDXArray[firstChar - args.mnMinCharPos - 1]
+- mvCharDxs[firstChar - mnMinCharPos - 1];
 }
 
 // update visual cluster
 long nDWidth = nNewClusterWidth - nOrigClusterWidth;
 if (firstChar >= args.mnMinCharPos)
 for (int n = firstChar; n <= lastChar; ++n)
-if (mvCharDxs[n - mnMinCharPos] != -1)
-mvCharDxs[n - mnMinCharPos] += nDWidth + nDGlyphOrigin;
+if (n > mnMinCharPos && mvCharDxs[n - mnMinCharPos - 1] != -1)
+mvCharDxs[n - mnMinCharPos - 1] += nDGlyphOrigin; // + 
nDWidth;
 for (unsigned int n = i; n < nLastGlyph; n++)
-mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin + nDWidth) * (bRtl ? 
-1 : 1);
+//mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin + nDWidth) * (bRtl 
? -1 : 1);
+mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin * (bRtl ? -1 : 1);
 
 rDeltaWidth[nBaseGlyph] = nDWidth;
 #ifdef GRLAYOUT_DEBUG
@@ -771,6 +775,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs , 
std::vector & rDelt
 // Update the dx vector with the new values.
 std::copy(args.mpDXArray, args.mpDXArray + nChars,
   mvCharDxs.begin() + (args.mnMinCharPos - mnMinCharPos));
+//args.mpDXArray[0] = 0;
 #ifdef GRLAYOUT_DEBUG
 fprintf(grLog(),"ApplyDx %ld(%ld)\n", args.mpDXArray[nChars - 1], mnWidth);
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-10-26 Thread Martin Hosken
 download.lst  |2 +-
 vcl/source/glyphs/graphite_layout.cxx |   23 +++
 2 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit f5be64cde53680bbff3ffa4d3b630f4fd2b6bca0
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Fri Oct 23 21:01:24 2015 +0700

Fix graphite line endings for stacking spaces

Change-Id: I63dab1bea8cbe9c702b543978d04fb6aeb7d363d
Reviewed-on: https://gerrit.libreoffice.org/19557
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/download.lst b/download.lst
index b1ebb89..d88d76a 100755
--- a/download.lst
+++ b/download.lst
@@ -52,7 +52,7 @@ export FREEHAND_TARBALL := libfreehand-0.1.1.tar.bz2
 export FREETYPE_TARBALL := 
dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
 export GLEW_TARBALL := 3941e9cab2f4f9d8faee3e8d57ae7664-glew-1.12.0.zip
 export GLM_TARBALL := 
bae83fa5dc7f081768daace6e199adc3-glm-0.9.4.6-libreoffice.zip
-export GRAPHITE_TARBALL := 7cda6fc6bc197b216777b15ce52c38a8-graphite2-1.3.3.tgz
+export GRAPHITE_TARBALL := 
5c0c9ac0996fbb4a0e17780ff5441959-graphite2-minimal-1.3.4.tgz
 export HARFBUZZ_MD5SUM := 0e27e531f4c4acff601ebff0957755c2
 export HARFBUZZ_TARBALL := harfbuzz-0.9.40.tar.bz2
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 4a723a3..eaff971 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -118,6 +118,13 @@ const gr_slot *get_next_base(const gr_slot *slot, bool 
bRtl)
 return slot;
 }
 
+bool isWhite(sal_Unicode nChar)
+{
+if (nChar <= 0x0020 || nChar == 0x00A0 || (nChar >= 0x2000 && nChar <= 
0x200F) || nChar == 0x3000)
+return true;
+return false;
+}
+
 // The Graphite glyph stream is really a sequence of glyph attachment trees
 //  each rooted at a non-attached base glyph.  fill_from walks the glyph 
stream,
 //  finds each non-attached base glyph and calls append to record them as a
@@ -135,6 +142,8 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs , float fSc
 int clusterStart = -1;
 int clusterFirstChar = -1;
 const gr_slot *nextBaseSlot;
+const sal_Unicode *pStr = rArgs.mrStr.getStr();
+int firstChar;
 
 if (!nGlyphs || lastCharPos - mnSegCharOffset == 0) return;
 const gr_slot* baseSlot = bRtl ? gr_seg_last_slot(pSegment) : 
gr_seg_first_slot(pSegment);
@@ -142,19 +151,24 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs , float fSc
 while (baseSlot && gr_slot_attached_to(baseSlot) != NULL && 
!gr_slot_can_insert_before(baseSlot))
 baseSlot = bRtl ? gr_slot_prev_in_segment(baseSlot) : 
gr_slot_next_in_segment(baseSlot);
 assert(baseSlot);
+int nextChar = gr_cinfo_base(gr_seg_cinfo(pSegment, 
gr_slot_before(baseSlot))) + mnSegCharOffset;
+float thisBoundary = 0.;
 float nextBoundary = gr_slot_origin_X(baseSlot);
 // now loop over bases
 for ( ; baseSlot; baseSlot = nextBaseSlot)
 {
-float thisBoundary = nextBoundary;
-int firstChar = gr_cinfo_base(gr_seg_cinfo(pSegment, 
gr_slot_before(baseSlot))) + mnSegCharOffset;
+firstChar = nextChar;
+thisBoundary = nextBoundary;
 nextBaseSlot = get_next_base(bRtl ? gr_slot_prev_in_segment(baseSlot) 
: gr_slot_next_in_segment(baseSlot), bRtl);
+nextChar = nextBaseSlot ? gr_cinfo_base(gr_seg_cinfo(pSegment, 
gr_slot_before(nextBaseSlot))) + mnSegCharOffset : -1;
 nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : 
gr_seg_advance_X(pSegment);
+
 if (firstChar < mnMinCharPos || firstChar >= mnEndCharPos)
 {
 // handle clipping of diacritic from base
 nextBaseSlot = bRtl ? gr_slot_prev_in_segment(baseSlot) : 
gr_slot_next_in_segment(baseSlot);
 nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : 
gr_seg_advance_X(pSegment);
+nextChar = nextBaseSlot ? gr_cinfo_base(gr_seg_cinfo(pSegment, 
gr_slot_before(nextBaseSlot))) + mnSegCharOffset : -1;
 continue;
 }
 // handle reordered clusters. Presumes reordered glyphs have monotonic 
opposite char index until the cluster base.
@@ -204,7 +218,8 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs , float fSc
 mvGlyph2Char[baseGlyph] = firstChar;
 append(pSegment, rArgs, baseSlot, thisBoundary, nextBoundary, 
fScaling, nDxOffset, true, firstChar, baseGlyph, bRtl);
 if (thisBoundary < fMinX) fMinX = thisBoundary;
-if (nextBoundary > fMaxX) fMaxX = nextBoundary;
+if (nextBoundary > fMaxX && (nextChar < mnMinCharPos || nextChar >= 
mnEndCharPos || !isWhite(pStr[nextChar]) || fMaxX <= 0.0f))
+fMaxX = nextBoundary;

adding graphite2 1.3.4 to download server

2015-10-22 Thread Martin Hosken
Dear All,

Please can someone pull the graphite2 source tarball for inclusion in graphite. 
The new version has shrunk from 8MB to <200K. So life has got a smidgen faster 
as a result and we've saved a few Joules of energy in the world :)

https://github.com/silnrsi/graphite/releases/download/1.3.4/graphite2-minimal-1.3.4.tgz

TIA,
Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2015-10-01 Thread Martin Hosken
 vcl/inc/graphite_layout.hxx   |2 -
 vcl/source/glyphs/graphite_layout.cxx |   67 +++---
 2 files changed, 31 insertions(+), 38 deletions(-)

New commits:
commit 07ecb1711487adfd35fc38099cae75459f10e6a9
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Tue Sep 29 15:59:42 2015 +0700

Graphite edge case line endings

Change-Id: I3ac15b79d47a79167717acfb5549a353b7520d3e
Reviewed-on: https://gerrit.libreoffice.org/18915
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index abb9acf..b97b351 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -151,7 +151,7 @@ private:
 const gr_slot * pSlot, float gOrigin,
 float nextGlyphOrigin, float fScaling,
 long & rDXOffset, bool bIsBase, int baseChar, int baseGlyph, 
bool bRtl);
-int ScanFwdForChar(int , bool fallback) const;
+unsigned int ScanFwdForChar(int , bool fallback) const;
 };
 
 #endif // INCLUDED_VCL_INC_GRAPHITE_LAYOUT_HXX
diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 10be4a0..1ba80bb 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -194,9 +194,14 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs , float fSc
 }
 
 int baseGlyph = mvGlyphs.size();
-mvCharBreaks[firstChar - mnMinCharPos] = 
gr_cinfo_break_weight(gr_seg_cinfo(pSegment, gr_slot_before(baseSlot)));
-mvChar2BaseGlyph[firstChar - mnMinCharPos] = baseGlyph;
-mvCharDxs[firstChar - mnMinCharPos] = static_cast((bRtl ? 
thisBoundary : nextBoundary) * fScaling) + mnWidth + nDxOffset;
+int scaledGlyphPos = round_to_long(gr_slot_origin_X(baseSlot) * 
fScaling) + mnWidth + nDxOffset;
+if (mvChar2Glyph[firstChar - mnMinCharPos] == -1 || 
mvGlyphs[mvChar2Glyph[firstChar - mnMinCharPos]].maLinearPos.X() < 
scaledGlyphPos)
+{
+mvChar2Glyph[firstChar - mnMinCharPos] = mvGlyphs.size();
+mvCharDxs[firstChar - mnMinCharPos] = static_cast((bRtl ? 
thisBoundary : nextBoundary) * fScaling) + mnWidth + nDxOffset;
+mvChar2BaseGlyph[firstChar - mnMinCharPos] = baseGlyph;
+mvCharBreaks[firstChar - mnMinCharPos] = 
gr_cinfo_break_weight(gr_seg_cinfo(pSegment, gr_slot_before(baseSlot)));
+}
 mvGlyph2Char[baseGlyph] = firstChar;
 append(pSegment, rArgs, baseSlot, thisBoundary, nextBoundary, 
fScaling, nDxOffset, true, firstChar, baseGlyph, bRtl);
 if (thisBoundary < fMinX) fMinX = thisBoundary;
@@ -274,17 +279,17 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs 
,
 assert(mvGlyphs.size() < mvGlyph2Char.size());
 if (firstChar < mnMinCharPos || firstChar >= mnEndCharPos)
 return nextGlyphOrigin;
-mvChar2Glyph[firstChar - mnMinCharPos] = mvGlyphs.size();
+
+long glyphId = gr_slot_gid(gi);
+long deltaOffset = 0;
+int scaledGlyphPos = round_to_long(gr_slot_origin_X(gi) * scaling) + 
mnWidth + rDXOffset;
+int glyphWidth = round_to_long((nextGlyphOrigin - gOrigin) * scaling);
 if (!bIsBase)
 {
 mvChar2BaseGlyph[firstChar - mnMinCharPos] = baseGlyph;
 mvCharDxs[firstChar - mnMinCharPos] = mvCharDxs[baseChar - 
mnMinCharPos];
 mvCharBreaks[firstChar - mnMinCharPos] = 
gr_cinfo_break_weight(gr_seg_cinfo(pSeg, gr_slot_before(gi)));
 }
-long glyphId = gr_slot_gid(gi);
-long deltaOffset = 0;
-int scaledGlyphPos = round_to_long(gr_slot_origin_X(gi) * scaling) + 
mnWidth;
-int glyphWidth = round_to_long((nextGlyphOrigin - gOrigin) * scaling);
 
 #ifdef GRLAYOUT_DEBUG
 fprintf(grLog(),"c%d g%ld,X%d W%d nX%f @%d=%d ", firstChar, glyphId,
@@ -323,7 +328,7 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs 
,
 nGlyphFlags |= (bRtl)? GlyphItem::IS_RTL_GLYPH : 0;
 GlyphItem aGlyphItem(mvGlyphs.size(),
 glyphId,
-Point(scaledGlyphPos + rDXOffset, round_to_long((-gr_slot_origin_Y(gi) 
* scaling))),
+Point(scaledGlyphPos, round_to_long((-gr_slot_origin_Y(gi) * 
scaling))),
 nGlyphFlags,
 glyphWidth);
 if (glyphId != static_cast(GF_DROPPED))
@@ -458,12 +463,12 @@ sal_Int32 GraphiteLayout::GetTextBreak(DeviceCoordinate 
maxmnWidth, DeviceCoordi
 {
 nWidth += char_extra;
 if (nWidth > maxmnWidth) break;
-if (mvChar2BaseGlyph[i] != -1)
+int gi = mvChar2BaseGlyph[i];
+if (gi != -1)
 {
-if (
+if (!mvGlyphs[gi].IsDiacritic() &&
 (mvCharBreaks[i] > -35 || (mvCharBreaks[i-1] > 0 && 
mvCharBreaks[i-1] < 35)) &&
-(mvCharBreaks[i-1] < 35 || (mvCharBreaks[i] < 0 && 
mvCharBre

[Libreoffice-commits] core.git: download.lst external/graphite vcl/source

2015-09-23 Thread Martin Hosken
 download.lst  |2 +-
 external/graphite/graphite2.win64.patch.1 |4 +++-
 vcl/source/glyphs/graphite_layout.cxx |7 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 69e670bee91c1c24cef184da4135d0dece33ecf6
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Tue Sep 22 11:23:03 2015 +0700

Fix graphite sole diacritic rendering

Change-Id: If44ab2ff8c860fbed2af3b4702fa031675e425f4
Reviewed-on: https://gerrit.libreoffice.org/18757
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/download.lst b/download.lst
index fae46de..4e329cf 100644
--- a/download.lst
+++ b/download.lst
@@ -61,7 +61,7 @@ export FREEHAND_TARBALL := libfreehand-0.1.1.tar.bz2
 export FREETYPE_TARBALL := 
dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
 export GLEW_TARBALL := 3941e9cab2f4f9d8faee3e8d57ae7664-glew-1.12.0.zip
 export GLM_TARBALL := 
bae83fa5dc7f081768daace6e199adc3-glm-0.9.4.6-libreoffice.zip
-export GRAPHITE_TARBALL := 5a99dbd27c6a1a707d28bd38ea808562-graphite2-1.3.2.tgz
+export GRAPHITE_TARBALL := 7cda6fc6bc197b216777b15ce52c38a8-graphite2-1.3.3.tgz
 export HARFBUZZ_MD5SUM := 0e27e531f4c4acff601ebff0957755c2
 export HARFBUZZ_TARBALL := harfbuzz-0.9.40.tar.bz2
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
diff --git a/external/graphite/graphite2.win64.patch.1 
b/external/graphite/graphite2.win64.patch.1
index 0286126..e7c36c6 100644
--- a/external/graphite/graphite2.win64.patch.1
+++ b/external/graphite/graphite2.win64.patch.1
@@ -1,11 +1,13 @@
 diff -ur graphite.org/src/inc/Main.h graphite/src/inc/Main.h
 --- graphite.org/src/inc/Main.h2015-09-07 20:09:25.572279671 +0700
 --- graphite/src/inc/Main.h2015-09-07 20:09:25.572279671 +0700
-@@ -25,6 +25,7 @@
+@@ -25,6 +25,9 @@
  of the License or (at your option) any later version.
  */
  #pragma once
++#ifdef _WIN32
 +#pragma warning(disable: 4510 4610)
++#endif
  
  #include 
  #include "graphite2/Types.h"
diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index bf38a49..305a5d4 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -152,7 +152,12 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs , float fSc
 nextBaseSlot = get_next_base(bRtl ? gr_slot_prev_in_segment(baseSlot) 
: gr_slot_next_in_segment(baseSlot), bRtl);
 nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : 
gr_seg_advance_X(pSegment);
 if (firstChar < mnMinCharPos || firstChar >= mnEndCharPos)
+{
+// handle clipping of diacritic from base
+nextBaseSlot = bRtl ? gr_slot_prev_in_segment(baseSlot) : 
gr_slot_next_in_segment(baseSlot);
+nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : 
gr_seg_advance_X(pSegment);
 continue;
+}
 // handle reordered clusters. Presumes reordered glyphs have monotonic 
opposite char index until the cluster base.
 bool isReordered = (nextBaseSlot && ((bRtl != 
(gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(nextBaseSlot))) < 
firstChar - mnSegCharOffset))
  || 
gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(nextBaseSlot))) == 
firstChar - mnSegCharOffset));
@@ -523,7 +528,7 @@ DeviceCoordinate GraphiteLayout::FillDXArray( 
DeviceCoordinate* pDXArray ) const
 void  GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs)
 {
 SalLayout::AdjustLayout(rArgs);
-if(rArgs.mpDXArray)
+if(rArgs.mpDXArray && mvGlyphs.size())
 {
 std::vector vDeltaWidths(mvGlyphs.size(), 0);
 ApplyDXArray(rArgs, vDeltaWidths);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


new version of graphite2

2015-09-22 Thread Martin Hosken
Dear All,

I've given up saying: this is it, but the code is stabalising. Please can 
someone upload graphite2-1.3.3.tgz from one of the usual haunts:

http://projects.palaso.org/attachments/download/436/graphite2-1.3.3.tgz
http://sourceforge.net/projects/silgraphite/files/graphite2/graphite2-1.3.3.tgz/download

BTW graphite2-1.3, graphite2-1.3.1 can be deleted if present. There is nothing 
anywhere that uses them.

TIA,
Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2015-09-17 Thread Martin Hosken
 external/graphite/StaticLibrary_graphite.mk |2 +-
 external/graphite/graphite2.win64.patch.1   |   11 +++
 vcl/inc/graphite_layout.hxx |2 +-
 vcl/source/glyphs/graphite_layout.cxx   |   16 +---
 4 files changed, 22 insertions(+), 9 deletions(-)

New commits:
commit 23b9febbd883f9db77ffb0216b050aaabc4c6510
Author: Martin Hosken <martin_hos...@sil.org>
Date:   Thu Sep 17 08:04:48 2015 +0700

Fix Graphite windows build static

Change-Id: I6feb3805e79f7cae4a8df7efa665fd97c56411c2
Reviewed-on: https://gerrit.libreoffice.org/18654
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/external/graphite/StaticLibrary_graphite.mk 
b/external/graphite/StaticLibrary_graphite.mk
index 0cfdb8f..ddbf995 100644
--- a/external/graphite/StaticLibrary_graphite.mk
+++ b/external/graphite/StaticLibrary_graphite.mk
@@ -20,7 +20,7 @@ $(eval $(call gb_StaticLibrary_set_include,graphite,\
 
 $(eval $(call gb_StaticLibrary_add_defs,graphite,\
-DGRAPHITE2_NTRACING \
-   -DGR2_STATIC \
+   -DGRAPHITE2_STATIC \
 ))
 
 ifeq ($(COM),GCC)
diff --git a/external/graphite/graphite2.win64.patch.1 
b/external/graphite/graphite2.win64.patch.1
index 5d409bb..0286126 100644
--- a/external/graphite/graphite2.win64.patch.1
+++ b/external/graphite/graphite2.win64.patch.1
@@ -1,3 +1,14 @@
+diff -ur graphite.org/src/inc/Main.h graphite/src/inc/Main.h
+--- graphite.org/src/inc/Main.h2015-09-07 20:09:25.572279671 +0700
+--- graphite/src/inc/Main.h2015-09-07 20:09:25.572279671 +0700
+@@ -25,6 +25,7 @@
+ of the License or (at your option) any later version.
+ */
+ #pragma once
++#pragma warning(disable: 4510 4610)
+ 
+ #include 
+ #include "graphite2/Types.h"
 diff -ur graphite.org/src/inc/json.h graphite/src/inc/json.h
 --- graphite.org/src/inc/json.h2015-02-03 14:49:24.408101900 +0100
 +++ graphite/src/inc/json.h2015-02-03 14:50:59.697552200 +0100
diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index 1378f88..abb9acf 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -93,7 +93,7 @@ public:
 private:
 const gr_face * mpFace; // not owned by layout
 gr_font *   mpFont; // not owned by layout
-int mnSegCharOffset; // relative to 
ImplLayoutArgs::mpStr
+unsigned intmnSegCharOffset; // relative to 
ImplLayoutArgs::mpStr
 longmnWidth;
 std::vectormvChar2BaseGlyph;
 std::vectormvChar2Glyph;
diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 07d19cf..bf38a49 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -148,14 +148,14 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs , float fSc
 for ( ; baseSlot; baseSlot = nextBaseSlot)
 {
 thisBoundary = nextBoundary;
-int firstChar = gr_slot_before(baseSlot) + mnSegCharOffset;
+int firstChar = gr_cinfo_base(gr_seg_cinfo(pSegment, 
gr_slot_before(baseSlot))) + mnSegCharOffset;
 nextBaseSlot = get_next_base(bRtl ? gr_slot_prev_in_segment(baseSlot) 
: gr_slot_next_in_segment(baseSlot), bRtl);
 nextBoundary = nextBaseSlot ? gr_slot_origin_X(nextBaseSlot) : 
gr_seg_advance_X(pSegment);
 if (firstChar < mnMinCharPos || firstChar >= mnEndCharPos)
 continue;
 // handle reordered clusters. Presumes reordered glyphs have monotonic 
opposite char index until the cluster base.
-bool isReordered = (nextBaseSlot && ((bRtl != 
(gr_slot_before(nextBaseSlot) < firstChar - mnSegCharOffset))
- || gr_slot_before(nextBaseSlot) 
== firstChar - mnSegCharOffset));
+bool isReordered = (nextBaseSlot && ((bRtl != 
(gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(nextBaseSlot))) < 
firstChar - mnSegCharOffset))
+ || 
gr_cinfo_base(gr_seg_cinfo(pSegment, gr_slot_before(nextBaseSlot))) == 
firstChar - mnSegCharOffset));
 if (clusterStart >= 0 && !isReordered)  // we hit the base (end) 
of a reordered cluster
 {
 int clusterEnd = mvGlyphs.size();
@@ -189,7 +189,7 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs , float fSc
 }
 
 int baseGlyph = mvGlyphs.size();
-mvCharBreaks[firstChar - mnMinCharPos] = 
gr_cinfo_break_weight(gr_seg_cinfo(pSegment, firstChar - mnSegCharOffset));
+mvCharBreaks[firstChar - mnMinCharPos] = 
gr_cinfo_break_weight(gr_seg_cinfo(pSegment, gr_slot_before(baseSlot)));
 mvChar2BaseGlyph[firstChar - mnMinCharPos] = baseGlyph;
 mvCharDxs[firstChar - mnMinCharPos] = static_cast((bRtl ? 
thisBoundary : nextBoundary) * fScaling) + mnWidth + nDxOff

Enabling graphite on all architectures

2015-09-17 Thread Martin Hosken
Dear All,

I notice in configure.ac that graphite is auto disabled for Darwin, iOS and 
Android. I'm wondering why this is the case and whether we can remove that 
constraint. The graphite engine used to be dependent on stl, but that is no 
longer the case. It adds 100K to vcl (and my sympathies are with those trying 
to shoehorn into the 50MB limit on Android). But it will repay with increased 
rendering speed.

Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: download.lst editeng/source external/graphite vcl/inc vcl/source vcl/win

2015-09-13 Thread Martin Hosken
 download.lst  |3 
 editeng/source/editeng/impedit3.cxx   |6 
 external/graphite/StaticLibrary_graphite.mk   |7 
 external/graphite/UnpackedTarball_graphite.mk |1 
 external/graphite/graphite2.issue1115.patch.1 |6 
 external/graphite/graphite2.win64.patch.1 |   21 
 vcl/inc/graphite_layout.hxx   |8 
 vcl/source/fontsubset/sft.cxx |3 
 vcl/source/gdi/pdfwriter_impl.cxx |   15 
 vcl/source/glyphs/graphite_layout.cxx |  757 --
 vcl/win/source/gdi/winlayout.cxx  |   15 
 11 files changed, 289 insertions(+), 553 deletions(-)

New commits:
commit 41007842ed9bb5d6165792a197769f72dae55a2c
Author: Martin Hosken <martin_hos...@sil.org>
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 <c...@libreoffice.org>
Reviewed-by: László Németh <nem...@numbertext.org>
Reviewed-by: Martin Hosken <martin_hos...@sil.org>

diff --git a/download.lst b/download.lst
index f821cf7..fae46de 100644
--- a/download.lst
+++ b/download.lst
@@ -61,8 +61,7 @@ export FREEHAND_TARBALL := libfreehand-0.1.1.tar.bz2
 export FREETYPE_TARBALL := 
dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
 export GLEW_TARBALL := 3941e9cab2f4f9d8faee3e8d57ae7664-glew-1.12.0.zip
 export GLM_TARBALL := 
bae83fa5dc7f081768daace6e199adc3-glm-0.9.4.6-libreoffice.zip
-export GRAPHITE_MD5SUM := 2ef839348fe28e3b923bf8cced440227
-export GRAPHITE_TARBALL := graphite2-1.2.4.tgz
+export GRAPHITE_TARBALL := 5a99dbd27c6a1a707d28bd38ea808562-graphite2-1.3.2.tgz
 export HARFBUZZ_MD5SUM := 0e27e531f4c4acff601ebff0957755c2
 export HARFBUZZ_TARBALL := harfbuzz-0.9.40.tar.bz2
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index ae3be6a..e5f10c0 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -720,6 +720,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 EditLine aSaveLine( *pLine );
 SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() );
 
+ImplInitLayoutMode( GetRefDevice(), nPara, nIndex );
+
 bool bCalcCharPositions = true;
 std::unique_ptr<long[]> pBuf(new long[ pNode->Len() ]);
 
@@ -1044,6 +1046,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 aTmpFont.SetPhysFont( GetRefDevice() );
 ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage());
 
+pPortion->SetRightToLeft( GetRightToLeft( nPara, nTmpPos+1 ) );
+
 if ( bCalcCharPositions || !pPortion->HasValidSize() )
 {
 pPortion->GetSize() = aTmpFont.QuickGetTextSize( 
GetRefDevice(), pParaPortion->GetNode()->GetString(), nTmpPos, 
pPortion->GetLen(), pBuf.get() );
@@ -1075,8 +1079,6 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 
 nTmpWidth += pPortion->GetSize().Width();
 
-pPortion->SetRightToLeft( GetRightToLeft( nPara, nTmpPos+1 ) );
-
 sal_Int32 _nPortionEnd = nTmpPos + pPortion->GetLen();
 if( bScriptSpace && ( _nPortionEnd < pNode->Len() ) && ( 
nTmpWidth < nXWidth ) && IsScriptChange( EditPaM( pNode, _nPortionEnd ) ) )
 {
diff --git a/external/graphite/StaticLibrary_graphite.mk 
b/external/graphite/StaticLibrary_graphite.mk
index de3950f..0cfdb8f 100644
--- a/external/graphite/StaticLibrary_graphite.mk
+++ b/external/graphite/StaticLibrary_graphite.mk
@@ -19,7 +19,7 @@ $(eval $(call gb_StaticLibrary_set_include,graphite,\
 ))
 
 $(eval $(call gb_StaticLibrary_add_defs,graphite,\
-   -DDISABLE_TRACING \
+   -DGRAPHITE2_NTRACING \
-DGR2_STATIC \
 ))
 
@@ -43,19 +43,22 @@ $(eval $(call 
gb_StaticLibrary_add_generated_cxxobjects,graphite,\
UnpackedTarball/graphite/src/gr_segment \
UnpackedTarball/graphite/src/gr_slot \
UnpackedTarball/graphite/src/json \
-   UnpackedTarball/graphite/src/Bidi \
UnpackedTarball/graphite/src/CachedFace \
UnpackedTarball/graphite/src/CmapCache \
UnpackedTarball/graphite/src/Code \
+   UnpackedTarball/graphite/src/Collider \
+   UnpackedTarball/graphite/src/Decompressor \
UnpackedTarball/graphite/src/Face \
UnpackedTarball/graphite/src/FeatureMap \
UnpackedTarball/graphite/src/FileFace \
UnpackedTarball/graphite/src/Font \
UnpackedTarball/graphite/src/GlyphCache \
UnpackedTarball/graphite/src/GlyphFace \
+   UnpackedTarball/graphite/src/Intervals \

graphite 1.3.2 release

2015-09-09 Thread Martin Hosken
Dear All,

I feel embarrassed to ask, yet again for a pull on graphite 1.3.2:

http://projects.palaso.org/attachments/download/434/graphite2-1.3.2.tgz
http://sourceforge.net/projects/silgraphite/files/graphite2/graphite2-1.3.2.tgz/download

But I need to do it because it's the last step before I push a patch to 
refactor the graphite integration so that it works, and is more understandable. 
Supporting this version of graphite with the old integration results in hangs 
and other severe nastinesses. So this work is long overdue.

TIA,
Yours,
Martin

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: graphite 1.3.1 released

2015-08-31 Thread Martin Hosken
Dear Miglos

> On Mon, Aug 31, 2015 at 10:56:47AM +0700, Martin Hosken
> <martin_hos...@sil.org> wrote:
> > OK so 1.3.0 wasn't the best release. Please can someone upload the
> > graphite2-1.3.1.tgz to the libreoffice source server and feel free
> > to delete 1.3.0 given it hasn't been used in any master code.  
> 
> Can you please give a full URL? Then it's easy to do so.

Sorry. Yes: 
http://sourceforge.net/projects/silgraphite/files/graphite2/graphite2-1.3.1.tgz/download

In fact, this will be a short lived upload. But I need it uploaded so that I 
can test the new integration. There will be a 1.3.2 soon to fix known bugs.

TIA,
Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


graphite 1.3.1 released

2015-08-30 Thread Martin Hosken
Dear All,

OK so 1.3.0 wasn't the best release. Please can someone upload the 
graphite2-1.3.1.tgz to the libreoffice source server and feel free to delete 
1.3.0 given it hasn't been used in any master code.

TIA,
Yours,
Martin.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


graphite2 released

2015-08-07 Thread Martin Hosken
Dear All,

Graphite has released a new version of its library and it would be good to get 
all that arabic goodness into libreoffice. Can someone upload the library from 
either of:

http://projects.palaso.org/attachments/download/427/graphite2-1.3.0.tgz
http://sourceforge.net/projects/silgraphite/files/graphite2/graphite2-1.3.0.tgz/download

Then I'll submit a patch to handle various improvements around graphite 
integration.

TIA,
Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2015-03-23 Thread Martin Hosken
 vcl/source/glyphs/graphite_layout.cxx |   33 ++---
 1 file changed, 18 insertions(+), 15 deletions(-)

New commits:
commit 12168aeea91a57e63159c3103c904d630c44c62e
Author: Martin Hosken martin_hos...@sil.org
Date:   Fri Mar 20 15:13:59 2015 +0700

fdo#52540 refix graphite layout generally

Change-Id: I13896adbc3d8b006c3b192dbf40e766d718a8bac
Reviewed-on: https://gerrit.libreoffice.org/14959
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 63194fc..d26a15f 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -569,33 +569,36 @@ gr_segment * 
GraphiteLayout::CreateSegment(ImplLayoutArgs rArgs)
 int limit = rArgs.mnEndCharPos;
 if (!(SAL_LAYOUT_COMPLEX_DISABLED  rArgs.mnFlags))
 {
-const int nSegCharMin = maximumint(0, mnMinCharPos - 
EXTRA_CONTEXT_LENGTH);
-const int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + 
EXTRA_CONTEXT_LENGTH);
-if (nSegCharMin  mnSegCharOffset)
+int nSegCharMin = maximumint(0, mnMinCharPos - 
EXTRA_CONTEXT_LENGTH);
+int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + 
EXTRA_CONTEXT_LENGTH);
+while (nSegCharMin  mnSegCharOffset)
 {
-int sameDirEnd = findSameDirLimit(rArgs.mpStr + nSegCharMin,
+int sameDirEnd = nSegCharMin + findSameDirLimit(rArgs.mpStr + 
nSegCharMin,
 rArgs.mnEndCharPos - nSegCharMin, bRtl);
-if (sameDirEnd == rArgs.mnEndCharPos)
+if (sameDirEnd = rArgs.mnMinCharPos)
+{
 mnSegCharOffset = nSegCharMin;
+break;
+}
+else
+nSegCharMin = sameDirEnd;
 }
 if (nSegCharLimit  limit)
 {
 limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos,
 nSegCharLimit - rArgs.mnEndCharPos, bRtl);
+if (limit  rArgs.mnLength)
+limit = rArgs.mnLength;
 }
 }
-
-size_t numchars = gr_count_unicode_characters(gr_utf16, rArgs.mpStr + 
mnSegCharOffset,
- rArgs.mpStr + (rArgs.mnLength  limit + 64 ? limit + 64 : 
rArgs.mnLength), NULL);
-static com::sun::star::uno::Reference 
com::sun::star::i18n::XCharacterClassification  xCharClass;
-if ( !xCharClass.is() )
-xCharClass = vcl::unohelper::CreateCharacterClassification();
-size_t numchars2 = rArgs.mnEndCharPos - mnSegCharOffset; // fdo#52540, 
fdo#68313, fdo#70666 avoid bad ligature replacement, fdo#88051 layout problem
-if (numchars  numchars2  (rArgs.mpStr[mnSegCharOffset + numchars2] 
== '\t' ||
-xCharClass-getType(rArgs.mpStr + mnSegCharOffset, numchars2 + 1) 
== ::com::sun::star::i18n::UnicodeType::LOWERCASE_LETTER))
+else
 {
-numchars = numchars2;
+limit = minimum(rArgs.mnLength, mnEndCharPos + 
EXTRA_CONTEXT_LENGTH);
+mnSegCharOffset = maximumint(0, mnMinCharPos - 
EXTRA_CONTEXT_LENGTH);
 }
+
+size_t numchars = gr_count_unicode_characters(gr_utf16, rArgs.mpStr + 
mnSegCharOffset,
+ rArgs.mpStr + limit, NULL);
 if (mpFeatures)
 pSegment = gr_make_seg(mpFont, mpFace, 0, mpFeatures-values(), 
gr_utf16,
 rArgs.mpStr + mnSegCharOffset, 
numchars, bRtl);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-02-12 Thread Martin Hosken
 vcl/generic/glyphs/graphite_serverfont.cxx |4 ++--
 vcl/inc/graphite_layout.hxx|   18 +++---
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 0ed14401925d16932ed98bc418d395adac047b39
Author: Martin Hosken martin_hos...@sil.org
Date:   Mon Feb 9 16:49:12 2015 +0700

Resolves: tdf#89252 Fix bold, regular font spacing bug for Graphite fonts

Change-Id: I31a09fa753ed15e302e5407ce8a0c46f3b13e099
Reviewed-on: https://gerrit.libreoffice.org/14380
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/generic/glyphs/graphite_serverfont.cxx 
b/vcl/generic/glyphs/graphite_serverfont.cxx
index 09159e4..3549c01 100644
--- a/vcl/generic/glyphs/graphite_serverfont.cxx
+++ b/vcl/generic/glyphs/graphite_serverfont.cxx
@@ -48,7 +48,7 @@ 
GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont rServerFont) thro
 , mpFeatures(NULL)
 , mpStr(NULL)
 {
-gr_font * pFont = 
rServerFont.GetGraphiteFace()-font(rServerFont.GetFontSelData().mnHeight);
+gr_font * pFont = 
rServerFont.GetGraphiteFace()-font(rServerFont.GetFontSelData().mnHeight, 
rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
 if (!pFont)
 {
 pFont = gr_make_font_with_advance_fn(
@@ -57,7 +57,7 @@ 
GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont rServerFont) thro
rServerFont,
freetypeServerFontAdvance,
rServerFont.GetGraphiteFace()-face());
-
rServerFont.GetGraphiteFace()-addFont(rServerFont.GetFontSelData().mnHeight, 
pFont);
+
rServerFont.GetGraphiteFace()-addFont(rServerFont.GetFontSelData().mnHeight, 
pFont, rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
 }
 maImpl.SetFont(pFont);
 OString aLang();
diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index f8abb79..7ccbe15 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -52,7 +52,8 @@ namespace grutils { class GrFeatureParser; }
 class GraphiteFaceWrapper
 {
 public:
-typedef std::mapint, gr_font* GrFontMap;
+typedef std::pairint, int GrFontMapKey;
+typedef std::mapGrFontMapKey, gr_font* GrFontMap;
 GraphiteFaceWrapper(gr_face * pFace) : m_pFace(pFace) {}
 ~GraphiteFaceWrapper()
 {
@@ -63,18 +64,21 @@ public:
 gr_face_destroy(m_pFace);
 }
 const gr_face * face() const { return m_pFace; }
-gr_font * font(int ppm) const
+gr_font * font(int ppm, bool isBold, bool isItalic) const
 {
-GrFontMap::const_iterator i = m_fonts.find(ppm);
+int styleKey = int(isBold) | (int(isItalic)  1);
+GrFontMap::const_iterator i = m_fonts.find(GrFontMapKey(ppm, 
styleKey));
 if (i != m_fonts.end())
 return i-second;
 return NULL;
 };
-void addFont(int ppm, gr_font * pFont)
+void addFont(int ppm, gr_font * pFont, bool isBold, bool isItalic)
 {
-if (m_fonts[ppm])
-gr_font_destroy(m_fonts[ppm]);
-m_fonts[ppm] = pFont;
+int styleKey = int(isBold) | (int(isItalic)  1);
+GrFontMapKey key(ppm, styleKey);
+if (m_fonts[key])
+gr_font_destroy(m_fonts[key]);
+m_fonts[key] = pFont;
 }
 private:
 gr_face * m_pFace;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-02-12 Thread Martin Hosken
 vcl/generic/glyphs/graphite_serverfont.cxx |4 ++--
 vcl/inc/graphite_layout.hxx|   18 +++---
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 0c2447648961bc8fa4776f996604fead893e3be4
Author: Martin Hosken martin_hos...@sil.org
Date:   Mon Feb 9 16:49:12 2015 +0700

Resolves: tdf#89252 Fix bold, regular font spacing bug for Graphite fonts

Change-Id: I31a09fa753ed15e302e5407ce8a0c46f3b13e099
Reviewed-on: https://gerrit.libreoffice.org/14380
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com
(cherry picked from commit 0ed14401925d16932ed98bc418d395adac047b39)
Reviewed-on: https://gerrit.libreoffice.org/14439

diff --git a/vcl/generic/glyphs/graphite_serverfont.cxx 
b/vcl/generic/glyphs/graphite_serverfont.cxx
index 09159e4..3549c01 100644
--- a/vcl/generic/glyphs/graphite_serverfont.cxx
+++ b/vcl/generic/glyphs/graphite_serverfont.cxx
@@ -48,7 +48,7 @@ 
GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont rServerFont) thro
 , mpFeatures(NULL)
 , mpStr(NULL)
 {
-gr_font * pFont = 
rServerFont.GetGraphiteFace()-font(rServerFont.GetFontSelData().mnHeight);
+gr_font * pFont = 
rServerFont.GetGraphiteFace()-font(rServerFont.GetFontSelData().mnHeight, 
rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
 if (!pFont)
 {
 pFont = gr_make_font_with_advance_fn(
@@ -57,7 +57,7 @@ 
GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont rServerFont) thro
rServerFont,
freetypeServerFontAdvance,
rServerFont.GetGraphiteFace()-face());
-
rServerFont.GetGraphiteFace()-addFont(rServerFont.GetFontSelData().mnHeight, 
pFont);
+
rServerFont.GetGraphiteFace()-addFont(rServerFont.GetFontSelData().mnHeight, 
pFont, rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
 }
 maImpl.SetFont(pFont);
 OString aLang();
diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index 6a84d54..c53b551 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -52,7 +52,8 @@ namespace grutils { class GrFeatureParser; }
 class GraphiteFaceWrapper
 {
 public:
-typedef std::mapint, gr_font* GrFontMap;
+typedef std::pairint, int GrFontMapKey;
+typedef std::mapGrFontMapKey, gr_font* GrFontMap;
 GraphiteFaceWrapper(gr_face * pFace) : m_pFace(pFace) {}
 ~GraphiteFaceWrapper()
 {
@@ -63,18 +64,21 @@ public:
 gr_face_destroy(m_pFace);
 }
 const gr_face * face() const { return m_pFace; }
-gr_font * font(int ppm) const
+gr_font * font(int ppm, bool isBold, bool isItalic) const
 {
-GrFontMap::const_iterator i = m_fonts.find(ppm);
+int styleKey = int(isBold) | (int(isItalic)  1);
+GrFontMap::const_iterator i = m_fonts.find(GrFontMapKey(ppm, 
styleKey));
 if (i != m_fonts.end())
 return i-second;
 return NULL;
 };
-void addFont(int ppm, gr_font * pFont)
+void addFont(int ppm, gr_font * pFont, bool isBold, bool isItalic)
 {
-if (m_fonts[ppm])
-gr_font_destroy(m_fonts[ppm]);
-m_fonts[ppm] = pFont;
+int styleKey = int(isBold) | (int(isItalic)  1);
+GrFontMapKey key(ppm, styleKey);
+if (m_fonts[key])
+gr_font_destroy(m_fonts[key]);
+m_fonts[key] = pFont;
 }
 private:
 gr_face * m_pFace;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - vcl/generic vcl/inc

2015-02-12 Thread Martin Hosken
 vcl/generic/glyphs/graphite_serverfont.cxx |4 ++--
 vcl/inc/graphite_layout.hxx|   18 +++---
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 19af334c922a9f3a25db68bc90ceb9446eeb79b0
Author: Martin Hosken martin_hos...@sil.org
Date:   Mon Feb 9 16:49:12 2015 +0700

Resolves: tdf#89252 Fix bold, regular font spacing bug for Graphite fonts

Change-Id: I31a09fa753ed15e302e5407ce8a0c46f3b13e099
Reviewed-on: https://gerrit.libreoffice.org/14380
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com
(cherry picked from commit 0ed14401925d16932ed98bc418d395adac047b39)
Reviewed-on: https://gerrit.libreoffice.org/14440

diff --git a/vcl/generic/glyphs/graphite_serverfont.cxx 
b/vcl/generic/glyphs/graphite_serverfont.cxx
index 09159e4..3549c01 100644
--- a/vcl/generic/glyphs/graphite_serverfont.cxx
+++ b/vcl/generic/glyphs/graphite_serverfont.cxx
@@ -48,7 +48,7 @@ 
GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont rServerFont) thro
 , mpFeatures(NULL)
 , mpStr(NULL)
 {
-gr_font * pFont = 
rServerFont.GetGraphiteFace()-font(rServerFont.GetFontSelData().mnHeight);
+gr_font * pFont = 
rServerFont.GetGraphiteFace()-font(rServerFont.GetFontSelData().mnHeight, 
rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
 if (!pFont)
 {
 pFont = gr_make_font_with_advance_fn(
@@ -57,7 +57,7 @@ 
GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont rServerFont) thro
rServerFont,
freetypeServerFontAdvance,
rServerFont.GetGraphiteFace()-face());
-
rServerFont.GetGraphiteFace()-addFont(rServerFont.GetFontSelData().mnHeight, 
pFont);
+
rServerFont.GetGraphiteFace()-addFont(rServerFont.GetFontSelData().mnHeight, 
pFont, rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
 }
 maImpl.SetFont(pFont);
 OString aLang();
diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index 7356bd5..8941a40 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -52,7 +52,8 @@ namespace grutils { class GrFeatureParser; }
 class GraphiteFaceWrapper
 {
 public:
-typedef std::mapint, gr_font* GrFontMap;
+typedef std::pairint, int GrFontMapKey;
+typedef std::mapGrFontMapKey, gr_font* GrFontMap;
 GraphiteFaceWrapper(gr_face * pFace) : m_pFace(pFace) {}
 ~GraphiteFaceWrapper()
 {
@@ -63,18 +64,21 @@ public:
 gr_face_destroy(m_pFace);
 }
 const gr_face * face() const { return m_pFace; }
-gr_font * font(int ppm) const
+gr_font * font(int ppm, bool isBold, bool isItalic) const
 {
-GrFontMap::const_iterator i = m_fonts.find(ppm);
+int styleKey = int(isBold) | (int(isItalic)  1);
+GrFontMap::const_iterator i = m_fonts.find(GrFontMapKey(ppm, 
styleKey));
 if (i != m_fonts.end())
 return i-second;
 return NULL;
 };
-void addFont(int ppm, gr_font * pFont)
+void addFont(int ppm, gr_font * pFont, bool isBold, bool isItalic)
 {
-if (m_fonts[ppm])
-gr_font_destroy(m_fonts[ppm]);
-m_fonts[ppm] = pFont;
+int styleKey = int(isBold) | (int(isItalic)  1);
+GrFontMapKey key(ppm, styleKey);
+if (m_fonts[key])
+gr_font_destroy(m_fonts[key]);
+m_fonts[key] = pFont;
 }
 private:
 gr_face * m_pFace;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/80/780/1'

2014-09-29 Thread Martin Hosken

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


[Libreoffice-commits] core.git: Changes to 'refs/changes/44/5644/1'

2014-09-29 Thread Martin Hosken

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


[Libreoffice-commits] core.git: Changes to 'refs/changes/44/5644/3'

2014-09-29 Thread Martin Hosken

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


[PATCH] Fix windows libo crash with graphite fonts.

2013-08-28 Thread Martin Hosken (via Code Review)
Hello LibreOffice gerrit bot,

I'd like you to reexamine a change.  Please visit

https://gerrit.libreoffice.org/5644

to look at the new patch set (#2).

Change subject: Fix windows libo crash with graphite fonts.
..

Fix windows libo crash with graphite fonts.

New master to base off, hoping it will build everywhere to pass gerrit.
Updates graphite library with bug fixes (and minimal improvements)
Proposed for stable branch update as well.

Change-Id: I6c5825420d9ea5768564253789a28412f3c1900a
---
M download.lst
M graphite/UnpackedTarball_graphite.mk
D graphite/graphite2.issue1030.patch.1
3 files changed, 1 insertion(+), 14 deletions(-)


  git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/44/5644/2
-- 
To view, visit https://gerrit.libreoffice.org/5644
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6c5825420d9ea5768564253789a28412f3c1900a
Gerrit-PatchSet: 2
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Martin Hosken martin_hos...@sil.org
Gerrit-Reviewer: LibreOffice gerrit bot ger...@libreoffice.org
Gerrit-Reviewer: Thorsten Behrens tbehr...@suse.com

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: download.lst graphite/graphite2.issue1030.patch.1 graphite/UnpackedTarball_graphite.mk

2013-08-28 Thread Martin Hosken
 download.lst |2 +-
 graphite/UnpackedTarball_graphite.mk |1 -
 graphite/graphite2.issue1030.patch.1 |   12 
 3 files changed, 1 insertion(+), 14 deletions(-)

New commits:
commit 36e1de2239a92b3969925167dd52d37021fb99d8
Author: Martin Hosken martin_hos...@sil.org
Date:   Tue Aug 27 16:28:54 2013 +0700

Fix windows libo crash with graphite fonts.

New master to base off, hoping it will build everywhere to pass gerrit.
Updates graphite library with bug fixes (and minimal improvements)
Proposed for stable branch update as well.

Change-Id: I6c5825420d9ea5768564253789a28412f3c1900a
Reviewed-on: https://gerrit.libreoffice.org/5644
Tested-by: LibreOffice gerrit bot ger...@libreoffice.org
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/download.lst b/download.lst
index 092aecb..8e233bf 100644
--- a/download.lst
+++ b/download.lst
@@ -42,7 +42,7 @@ export FONT_PTSERIF_TARBALL := 
c3c1a8ba7452950636e871d25020ce0d-pt-serif-font-1.
 export FONT_SOURCECODE_TARBALL := 
0279a21fab6f245e85a6f85fea54f511-source-code-font-1.009.tar.gz
 export FONT_SOURCESANS_TARBALL := 
1e9ddfe25ac9577da709d7b2ea36f939-source-sans-font-1.036.tar.gz
 export FREETYPE_TARBALL := 
dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
-export GRAPHITE_TARBALL := f5ef3f7f10fa8c3542c6a085a233080b-graphite2-1.2.0.tgz
+export GRAPHITE_TARBALL := 7042305e4208af4c2d5249d814ccce58-graphite2-1.2.3.tgz
 export GLIBC_TARBALL := 
4a660ce8466c9df01f19036435425c3a-glibc-2.1.3-stub.tar.gz
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
 export HUNSPELL_TARBALL := 
3121aaf3e13e5d88dfff13fb4a5f1ab8-hunspell-1.3.2.tar.gz
diff --git a/graphite/UnpackedTarball_graphite.mk 
b/graphite/UnpackedTarball_graphite.mk
index a25b316..a690ac3 100644
--- a/graphite/UnpackedTarball_graphite.mk
+++ b/graphite/UnpackedTarball_graphite.mk
@@ -15,7 +15,6 @@ $(eval $(call 
gb_UnpackedTarball_set_tarball,graphite,$(GRAPHITE_TARBALL)))
 # http://projects.palaso.org/issues/1115
 $(eval $(call gb_UnpackedTarball_add_patches,graphite,\
graphite/graphite2.patch \
-   graphite/graphite2.issue1030.patch.1 \
graphite/graphite2.issue1115.patch.1 \
 ))
 
diff --git a/graphite/graphite2.issue1030.patch.1 
b/graphite/graphite2.issue1030.patch.1
deleted file mode 100644
index 2bfe1a1..000
--- a/graphite/graphite2.issue1030.patch.1
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up workdir/wntgcci.pro/UnpackedTarball/graphite/src/gr_logging.cpp.dt 
workdir/wntgcci.pro/UnpackedTarball/graphite/src/gr_logging.cpp
 graphite/src/gr_logging.cpp.dt 2012-10-31 07:40:57.527381144 +0100
-+++ graphite/src/gr_logging.cpp2012-10-31 07:40:59.522333851 +0100
-@@ -33,7 +33,7 @@ of the License or (at your option) any l
- #include inc/Segment.h
- 
- #if defined _WIN32
--#include Windows.h
-+#include windows.h
- #endif
- 
- using namespace graphite2;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Download request

2012-10-06 Thread Martin Hosken
Please could someone download an upgrade to the graphite code so that when I 
submit the patch it won't break the build.

http://projects.palaso.org/attachments/download/298/graphite2-1.2.0.tgz

the md5sum is presumed to be: f5ef3f7f10fa8c3542c6a085a233080b

TIA,
Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[PATCH] Update graphite to 1.2.0

2012-10-06 Thread Martin Hosken (via Code Review)
Hi,

I have submitted a patch for review:

https://gerrit.libreoffice.org/780

To pull it, you can do:

git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/80/780/1

Update graphite to 1.2.0

Change-Id: I768df17c12e918a39e2011e3ce639e0c4ac4d451
---
M graphite/graphite2.patch
M graphite/graphite_make.patch
M graphite/makefile.mk
M ooo.lst.in
4 files changed, 13 insertions(+), 13 deletions(-)


--
To view, visit https://gerrit.libreoffice.org/780
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I768df17c12e918a39e2011e3ce639e0c4ac4d451
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Martin Hosken martin_hos...@sil.org

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Adding Extension for Experimental Thai Spelling

2012-09-27 Thread Martin Hosken
Dear Nathan,

 Here are some new ideas, ordered by desirability, with number one being the
 most desired, to number three being the least.
 
 1) When a zero-width space is detected (U+200B), shut off ICU breakiterator
 for Khmer spell checking for characters following the zero-width space
 until encounters real space (U+0020) or end of sentence (detect end of
 sentence using ICU Sentence Boundary).

I think this is a good direction to head. I have to follow on comments:

1. If you are shutting off the ICU breakiterator for text following, we should 
probably also do it for text preceding. Thus if there is a ZWSP or ZWNBSP 
(U+2060 WJ) anywhere in a text then ICU break iteration is disabled for the 
whole sentence.

2. Why limit this to Khmer? I suspect as a model it should work for any 
non-space broken text.

Yours,
Martin



 
 2) Disable use of ICU breakiterator for Khmer spell checking by default,
 but allow users to enable it by adding a check-box to enable ICU
 breakiterator in the Tools  Options  Language Settings  Writing Aids 
 Options dialogue when a Khmer Hunspell dictionary is present (
 http://extensions.libreoffice.org/extension-center/khmer-spelling-checker-sbbic-version
  ).
 
 3) Disable use of ICU breakiterator for Khmer spell checking until the ICU
 breakiterator for Khmer is more accurate.
 
 Currently, with the ICU breakiterator for Khmer enabled in LibreOffice 3.6
 it causes a lot of spelling errors to go unnoticed since the ICU
 breakiterator breaks words up incorrectly. So hopfully we can find a
 solution that will work with the current ICU breakiterator - though with
 ICU 50.1 the breakiterator for Khmer will have some improvements. But I do
 feel if solution 1 or 2 (or if someone else has better ideas) cannot
 be implemented the breakiterator for spelling with Khmer should be turned
 off in LibreOffice until the ICU breakiterator for Khmer is more accurate.
 
 
 Thanks again for your help and time, your input is greatly appreciated!
 
 Sincerely,
 
 Nathan
 
 
 
 On Thu, Jul 26, 2012 at 4:33 PM, Martin Hosken martin_hos...@sil.orgwrote:
 
  Dear All,
 
An automatic word and line breaker is very necessary for Khmer and
Thai because traditionally they have no spaces between words, and so
line-breaking and spell checking require the use of a zero-width space
between words which is counterintuitive for most native speakers, and
so spell checking goes widely unused.
 
  I agree that automatic word breaking is a good thing and I am relieved to
  see that libreoffice does it based on language selection and not on
  automatic language guessing based on scripts. There are more languages that
  use Thai script and Khmer script than just Thai and Khmer. So one of my
  fears is already alleviated :)
 
But now with the ICU code you implemented, Thai and Khmer can be
automatically broken, and the results are quite good. But with its
implementation in the real world, I have found some issues that I
wanted to raise and also suggest possible solutions. I write this as
an end-user, not so much as a programmer, nor do I claim to fully
understand the inner-workings of ICU and LibreOffice (because I don't!
).
   
First, I will do my best to explain the current results of the ICU
break iterator with Khmer:
   
Input sentence: មានប្រាជ្ញាឈ្លាសវៃឈ្មោះសិវកឥវលិយៈ
   
Current ICU line-breaking: មាន|ប្រាជ្ញាឈ្លាស|វៃ|ឈ្មោះ|សិវ|កឥ|វលិ|យៈ
   
Compared with the sentence manually broken: មាន|ប្រាជ្ញា|ឈ្លាសវៃ|
ឈ្មោះ|សិវកឥវលិយៈ
   
The differences should be clear – the ICU break iterator does not
break the words with 100% accuracy.
   
One possible solution to this issue is by how the ICU Break Iterator
interacts with zero-width spaces (U+200B) in LibreOffice. Before ICU
code was enabled to automatically break Khmer, if an end-user wanted
to spell check Khmer, they had to manually place U+200B characters to
separate words. This solution worked quite well, but was
counterintuitive to most native speakers, because Khmer has no spaces
(as stated before). But with this solution, an end-user could be sure
that their document was broken with 100% accuracy, if there was no
human error (something automatic solutions cannot do – it is more
along the lines of 80% accurate). What I propose, is that the break
iterator code in LibreOffice looks for U+200B characters in a given
string and considers them as a sign to NOT automatically break, but to
allow the end-user full control to manually break words. Let me
explain:
   
 1. The code starts processing the text and automatically breaking
it until it comes across a U+200B character. If one is found,
it searches to see if there are any additional U+200B or U
+0020 characters in the following 20 characters (or so), and
if there are, the break iterator skips over those characters

Re: Adding Extension for Experimental Thai Spelling

2012-07-26 Thread Martin Hosken
Dear All,

  An automatic word and line breaker is very necessary for Khmer and
  Thai because traditionally they have no spaces between words, and so
  line-breaking and spell checking require the use of a zero-width space
  between words which is counterintuitive for most native speakers, and
  so spell checking goes widely unused.

I agree that automatic word breaking is a good thing and I am relieved to see 
that libreoffice does it based on language selection and not on automatic 
language guessing based on scripts. There are more languages that use Thai 
script and Khmer script than just Thai and Khmer. So one of my fears is already 
alleviated :)

  But now with the ICU code you implemented, Thai and Khmer can be
  automatically broken, and the results are quite good. But with its
  implementation in the real world, I have found some issues that I
  wanted to raise and also suggest possible solutions. I write this as
  an end-user, not so much as a programmer, nor do I claim to fully
  understand the inner-workings of ICU and LibreOffice (because I don't!
  ).
  
  First, I will do my best to explain the current results of the ICU
  break iterator with Khmer:
  
  Input sentence: មានប្រាជ្ញាឈ្លាសវៃឈ្មោះសិវកឥវលិយៈ
  
  Current ICU line-breaking: មាន|ប្រាជ្ញាឈ្លាស|វៃ|ឈ្មោះ|សិវ|កឥ|វលិ|យៈ
  
  Compared with the sentence manually broken: មាន|ប្រាជ្ញា|ឈ្លាសវៃ|
  ឈ្មោះ|សិវកឥវលិយៈ
  
  The differences should be clear – the ICU break iterator does not
  break the words with 100% accuracy.
  
  One possible solution to this issue is by how the ICU Break Iterator
  interacts with zero-width spaces (U+200B) in LibreOffice. Before ICU
  code was enabled to automatically break Khmer, if an end-user wanted
  to spell check Khmer, they had to manually place U+200B characters to
  separate words. This solution worked quite well, but was
  counterintuitive to most native speakers, because Khmer has no spaces
  (as stated before). But with this solution, an end-user could be sure
  that their document was broken with 100% accuracy, if there was no
  human error (something automatic solutions cannot do – it is more
  along the lines of 80% accurate). What I propose, is that the break
  iterator code in LibreOffice looks for U+200B characters in a given
  string and considers them as a sign to NOT automatically break, but to
  allow the end-user full control to manually break words. Let me
  explain:
  
   1. The code starts processing the text and automatically breaking
  it until it comes across a U+200B character. If one is found,
  it searches to see if there are any additional U+200B or U
  +0020 characters in the following 20 characters (or so), and
  if there are, the break iterator skips over those characters
  and starts again from the second U+200B character (or U+0020,
  but a U+0020 character would only signify the “close” of the
  manual break because sometimes a phrase will end and there
  will be an actual space – so if the word that the user wants
  to manually break has a “real” U+0020 space at the end of it,
  then the user does not need to put an additional U+200B
  character to close it) which then repeats, looking for U+200B
  characters etc.
  
   2. This would allow end-users to choose to manually break their
  whole document so they can have precise control, as well as
  allow end-users to place U+200B characters around names of
  people, places or transliterations in order to tell the break
  iterator to not try to break those words.

In principle I like this approach. I like the idea of being able to force 
breaks and non-breaks. But I don't think we are quite there with this solution 
yet. Here are my difficulties with it:

1. use of U+2060 makes string searching and spell checking harder (unless WJ 
chars are stripped for searching and spell checking). They are not part of the 
spelling of a word, so their introduction in the underlying text stream is 
problematic for other text processing processes (like searching as mentioned). 
This is less of an issue for U+200B ZWSP because that occurs between words and 
searching across word boundaries is a rarer activity. Likewise spell checking 
across word boundaries isn't really needed.

2. How do we come up with the range of what is considered a word between two 
zwsp chars as opposed to two words? How close to the end of a string must a 
zwsp occur to disable all breaking before the end of the string? does 
abcdefzwspuvwxyz block all breaks in the string? I think we need to think 
harder (deeper) about the use of zwsp in this way and see if we can come up 
with something with a little less ambiguity. Having said that, I think we are 
going to have to think really hard, because I don't think this is an easy 
problem.

   4. I then notice that ម្នាក់ទៀត line breaks together (since the
  

relicensing

2012-05-03 Thread Martin Hosken
Dear All,

All of my past  future contributions to LibreOffice may be
licensed under the MPL/LGPLv3+ dual license.

Yours,
Martin Hosken
NRSI, SIL International
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2012-04-04 Thread Martin Hosken
 vcl/inc/graphite_layout.hxx   |4 +-
 vcl/source/glyphs/graphite_layout.cxx |   46 ++
 2 files changed, 27 insertions(+), 23 deletions(-)

New commits:
commit 9b6b1558a3654625ce9a5bef2bee5245db81ff88
Author: Martin Hosken martin_hos...@sil.org
Date:   Wed Apr 4 14:44:33 2012 +0700

Fix cursor movement in graphite fonts

diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index c6c711d..838c32d 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -163,9 +163,9 @@ private:
 void expandOrCondense(ImplLayoutArgs rArgs);
 voidfillFrom(gr_segment * rSeg, ImplLayoutArgs  rArgs, float 
fScaling);
 
-void append(gr_segment * pSeg,
+float append(gr_segment * pSeg,
 ImplLayoutArgs  rArgs,
-const gr_slot * pSlot,
+const gr_slot * pSlot, float gOrigin,
 float nextGlyphOrigin, float fScaling,
 long  rDXOffset, bool bIsBase, int baseChar);
 };
diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 93c1bc5..4edeb9a 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -40,6 +40,8 @@
 #undef NDEBUG
 #endif
 
+// #define GRLAYOUT_DEBUG 1
+
 // Header files
 //
 // Standard Library
@@ -274,7 +276,7 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs rArgs, float fSc
 }
 mvChar2BaseGlyph[mnSegCharOffset + nFirstCharInCluster - 
mnMinCharPos] = nBaseGlyphIndex;
 }
-append(pSegment, rArgs, baseSlot, rightBoundary, fScaling,
+append(pSegment, rArgs, baseSlot, gr_slot_origin_X(baseSlot), 
rightBoundary, fScaling,
nDxOffset, bCluster, mnSegCharOffset + firstChar);
 }
 if (mnSegCharOffset + nLastCharInCluster  mnMinCharPos)
@@ -353,7 +355,7 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs rArgs, float fSc
 // only set mvChar2BaseGlyph for first character of cluster
 mvChar2BaseGlyph[mnSegCharOffset + bFirstChar - 
mnMinCharPos] = nBaseGlyphIndex;
 }
-append(pSegment, rArgs, baseSlot, rightBoundary, fScaling,
+append(pSegment, rArgs, baseSlot, gr_slot_origin_X(baseSlot), 
rightBoundary, fScaling,
nDxOffset, true, mnSegCharOffset + firstChar);
 }
 if (mnSegCharOffset + bFirstChar = mnEndCharPos)
@@ -409,13 +411,13 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs rArgs, float fSc
 
 // append walks an attachment tree, flattening it, and converting it into a
 // sequence of GlyphItem objects which we can later manipulate.
-void
+float
 GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs rArgs,
-const gr_slot * gi, float nextGlyphOrigin, float scaling, long  rDXOffset,
+const gr_slot * gi, float gOrigin, float nextGlyphOrigin, float scaling, 
long  rDXOffset,
 bool bIsBase, int baseChar)
 {
 bool bRtl = (rArgs.mnFlags  SAL_LAYOUT_BIDI_RTL);
-float nextOrigin = nextGlyphOrigin;
+float nextOrigin;
 assert(gi);
 assert(gr_slot_before(gi) = gr_slot_after(gi));
 int firstChar = gr_slot_before(gi) + mnSegCharOffset;
@@ -424,16 +426,22 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs 
rArgs,
 // is the next glyph attached or in the next cluster?
 //glyph_set_range_t iAttached = gi.attachedClusterGlyphs();
 const gr_slot * pFirstAttached = gr_slot_first_attachment(gi);
+const gr_slot * pNextSibling = gr_slot_next_sibling_attachment(gi);
 if (pFirstAttached)
-{
 nextOrigin = gr_slot_origin_X(pFirstAttached);
-}
+else if (!bIsBase  pNextSibling)
+nextOrigin = gr_slot_origin_X(pNextSibling);
+else
+nextOrigin = nextGlyphOrigin;
 long glyphId = gr_slot_gid(gi);
 long deltaOffset = 0;
 int scaledGlyphPos = round(gr_slot_origin_X(gi) * scaling);
-int glyphWidth = round(nextOrigin * scaling) - scaledGlyphPos;
-if (glyphWidth  0)
-glyphWidth = 0;
+int glyphWidth = round((nextOrigin - gOrigin) * scaling);
+//if (glyphWidth  0)
+//{
+//nextOrigin = gOrigin;
+//glyphWidth = 0;
+//}
 #ifdef GRLAYOUT_DEBUG
 fprintf(grLog(),c%d g%ld,X%d W%d nX%f , firstChar, glyphId,
 (int)(gr_slot_origin_X(gi) * scaling), glyphWidth, nextOrigin * 
scaling);
@@ -481,16 +489,11 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs 
rArgs,
 rDXOffset += deltaOffset;
 
 // Recursively append all the attached glyphs.
-for (const gr_slot * agi = gr_slot_first_attachment(gi); agi != NULL;
- agi = gr_slot_next_sibling_attachment(agi))
-{
-if (gr_slot_next_sibling_attachment(agi) == NULL)
-append(pSeg, rArgs, agi, nextGlyphOrigin, scaling, rDXOffset

5.3 pull request

2012-04-04 Thread Martin Hosken
Dear All,

I've just fixed a graphite integration bug that stops the cursor doing crazy 
things with some fonts (including some of the wilder things with libertine-g). 
I've probably missed the boat for 5.2 so this is a request to have the commit: 
9b6b1558a3654625ce9a5bef2bee5245db81ff88 pulled into 5.3 when it comes about.

TIA,
Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [REVIEW][3-5] fix STL assertion in vcl graphite code

2012-03-19 Thread Martin Hosken
Dear Petr,

Thank you for the reminder of this issue. My apologies for not getting to it 
earlier.

  
  I do not understand the code either. I just wonder if it would make
  sense to check for:
  
  while (++nCharIndex - mnMinCharPos 
  static_castint(mvChar2BaseGlyph.size()))
  
  As the array is accessed as mvChar2BaseGlyph[nCharIndex-mnMinCharPos].
  Otherwise, the cycle might end too early. 
  
  Another conservative solution would be to combine it with the original
  check:
  
  while (++nCharIndex  static_castint(mvGlyph2Char.size()) 
 nCharIndex - mnMinCharPos 
  static_castint(mvChar2BaseGlyph.size()))
 
 Any other opinion here, please?

I would go with the first of these. It makes no sense to compare a charIndex 
against a glyph-char mapping array, whose size is the number of glyphs, not 
characters. I think it is simply a bug.

Notice that I am not claiming authoritative understanding of this code since it 
was written by Keith, who unfortunately is no longer with us and so cannot 
comment. I am hoping that when I eventually get time to work on this code, and 
particularly the mac port, I can refactor the code and gain the necessary 
authoritative confidence.

Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] .: graphite/graphite2.patch graphite/graphite_make.patch graphite/makefile.mk ooo.lst.in vcl/source

2011-09-22 Thread Martin Hosken
 graphite/graphite2.patch  |4 ++--
 graphite/graphite_make.patch  |4 ++--
 graphite/makefile.mk  |7 +++
 ooo.lst.in|2 +-
 vcl/source/glyphs/graphite_layout.cxx |   33 +++--
 5 files changed, 27 insertions(+), 23 deletions(-)

New commits:
commit 162676cb6a940636e958b5787a626d814865ab86
Author: Martin Hosken martin_hos...@sil.org
Date:   Thu Sep 22 22:46:33 2011 +0700

Upgrade graphite to 1.0.3 fix surrogate support

diff --git a/graphite/graphite2.patch b/graphite/graphite2.patch
index a13ef07..d5a9565 100644
--- a/graphite/graphite2.patch
+++ b/graphite/graphite2.patch
@@ -1,5 +1,5 @@
 misc/graphite2-1.0.2/include/graphite2/Types.h 2011-02-12 
16:54:16.0 +0100
-+++ misc/build/graphite2-1.0.2/include/graphite2/Types.h   2011-03-15 
21:38:06.264788098 +0100
+--- misc/graphite2-1.0.3/include/graphite2/Types.h 2011-02-12 
16:54:16.0 +0100
 misc/build/graphite2-1.0.3/include/graphite2/Types.h   2011-03-15 
21:38:06.264788098 +0100
 @@ -36,7 +36,8 @@
  };
  
diff --git a/graphite/graphite_make.patch b/graphite/graphite_make.patch
index c137c12..4532163 100644
--- a/graphite/graphite_make.patch
+++ b/graphite/graphite_make.patch
@@ -1,5 +1,5 @@
 misc/build/graphite2-1.0.2/src/makefile.mk  Fri Mar  4 10:20:30 2011 +0700
-+++ misc/build/graphite2-1.0.2/src/makefile.mk  Fri Mar  4 10:20:30 2011 +0700
+--- misc/build/graphite2-1.0.3/src/makefile.mk  Fri Mar  4 10:20:30 2011 +0700
 misc/build/graphite2-1.0.3/src/makefile.mk  Fri Mar  4 10:20:30 2011 +0700
 @@ -1,1 +1,38 @@
 -dummy
 +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
diff --git a/graphite/makefile.mk b/graphite/makefile.mk
index 522c261..3793d6c 100644
--- a/graphite/makefile.mk
+++ b/graphite/makefile.mk
@@ -45,11 +45,10 @@ all:
 
 # --- Files 
 .IF $(ENABLE_GRAPHITE)==TRUE
-TARFILE_NAME=graphite2-1.0.2
-TARFILE_MD5=3115c721f5cb7c464f01c2dddccfaba6
+TARFILE_NAME=graphite2-1.0.3
+TARFILE_MD5=3bf481ca95109b14435125c0dd1f2217
 PATCH_FILES= graphite2.patch \
-graphite_make.patch \
-graphite2.placementnew.patch
+graphite_make.patch 
 
 ADDITIONAL_FILES= \
 src/makefile.mk
diff --git a/ooo.lst.in b/ooo.lst.in
index 63170f6..84ea135 100644
--- a/ooo.lst.in
+++ b/ooo.lst.in
@@ -87,7 +87,7 @@ d6447e3ae278800c58ae40b740c861c0-libwpd-0.9.3.tar.bz2
 0ff7d225d087793c8c2c680d77aac3e7-mdds_0.5.3.tar.bz2
 f02578f5218f217a9f20e9c30e119c6a-boost_1_44_0.tar.bz2
 3121aaf3e13e5d88dfff13fb4a5f1ab8-hunspell-1.3.2.tar.gz
-3115c721f5cb7c464f01c2dddccfaba6-graphite2-1.0.2.tgz
+3bf481ca95109b14435125c0dd1f2217-graphite2-1.0.3.tgz
 cfb4259665fa96874deaa1b233d0b9c2-libvisio-0.0.7.tar.bz2
 881af2b7dca9b8259abbca00bbbc004d-LinLibertineG-20110101.zip
 @GOOGLE_DOCS_EXTENSION_PACK@
diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 46de93a..a0f48c8 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -36,9 +36,9 @@
 #define GR_NAMESPACE
 
 // Enable lots of debug info
-#ifdef DEBUG
+#if OSL_DEBUG_LEVEL  1
 #include cstdio
-//#define GRLAYOUT_DEBUG 1
+#define GRLAYOUT_DEBUG 1
 #undef NDEBUG
 #endif
 
@@ -329,8 +329,9 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs rArgs, float fSc
 float leftBoundary = gr_slot_origin_X(clusterFirst);
 float rightBoundary = (clusterAfter)?
 gr_slot_origin_X(clusterAfter) : gr_seg_advance_X(pSegment);
-if (mnSegCharOffset + nFirstCharInCluster = mnMinCharPos 
-mnSegCharOffset + nFirstCharInCluster  mnEndCharPos)
+size_t bFirstChar = gr_cinfo_base(gr_seg_cinfo(pSegment, 
nFirstCharInCluster));
+if (mnSegCharOffset + bFirstChar = mnMinCharPos 
+mnSegCharOffset + bFirstChar  mnEndCharPos)
 {
 fMinX = minimumfloat(fMinX, leftBoundary);
 fMaxX = maximumfloat(fMaxX, rightBoundary);
@@ -338,21 +339,22 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, 
ImplLayoutArgs rArgs, float fSc
 {
 for (int i = nFirstCharInCluster; i = nLastCharInCluster; 
i++)
 {
-if (mnSegCharOffset + i = mnEndCharPos)
+size_t ibase = gr_cinfo_base(gr_seg_cinfo(pSegment, 
i));
+if (mnSegCharOffset + ibase = mnEndCharPos)
 break;
 // from the point of view of the dx array, the xpos is
 // the origin of the first glyph of the next cluster 
ltr
-mvCharDxs[mnSegCharOffset + i - mnMinCharPos] =
+mvCharDxs[mnSegCharOffset + ibase - mnMinCharPos] =
 static_castint(rightBoundary * fScaling) + 
nDxOffset

Re: [Libreoffice] [PATCH] libstdc++ STL debug

2011-09-16 Thread Martin Hosken
Dear All,

 * graphite: apparently built with dmake, so a problem only if from system

graphite used to require STL, but with 3.4 and gr2, no such requirement or 
exposure remains. Graphite is built using dmake, but is a relatively simple 
library to package and could easily be converted to another make if someone so 
desired (an easy fruit to pick).

Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] cherry pick graphite into 3.4.4

2011-08-23 Thread Martin Hosken
This is a request for revision 6aed24cc5bc1 to be cherry picked from master 
into the latest 3.4.

TIA,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Graphite 1.0.1

2011-08-16 Thread Martin Hosken
Dear Michael,

   Shame - I guess this missed the 3.4.3 release deadline (unless we can
 get the patch, and triple review it soon); but we can get it in for
 3.4.4 no doubt - and clearly pushing to master is easy enough.

I enclose the patch. It is a simple patch in that it removes the existing bug 
fix patching from the graphite source, creates a new patch that only patches 
what libo needs to modify in the code, simplifies the libo specific makefile 
for graphite and updates the file references.

   I assume 1.0.1 is mostly just bug fixes Martin ?

Well we went up to 1.0.2 to fix a windows build bug, but yes. And there are 
some memory savings and general all round goodness improvements inside the 
graphite engine. There is no actual code change within libo. One particular 
improvement is in bidi mirroring which it would be nice to have in 3.4.3 but 
not esesential. It should also go into master.

I don't really know how to submit a patch across 2 git repos, but here it is.

Yours,
Martin
diff --git a/ooo.lst.in b/ooo.lst.in
index 3652a39..cbf1fb6 100644
--- a/ooo.lst.in
+++ b/ooo.lst.in
@@ -79,7 +79,7 @@ debc62758716a169df9f62e6ab2bc634-zlib-1.2.3.tar.gz
 0ff7d225d087793c8c2c680d77aac3e7-mdds_0.5.3.tar.bz2
 f02578f5218f217a9f20e9c30e119c6a-boost_1_44_0.tar.bz2
 9ed97fce60a9a65852402248a6659492-hunspell-1.3.1.tar.gz
-0625a7d661f899a8ce263fc8a9879108-graphite2-0.9.2.tgz
+3115c721f5cb7c464f01c2dddccfaba6-graphite2-1.0.2.tgz
 http://download.go-oo.org/extern
 185d60944ea767075d27247c3162b3bc-unowinreg.dll
 b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2
diff --git a/graphite/graphite2-0.9.2.patch b/graphite/graphite2-0.9.2.patch
deleted file mode 100644
index a775c1f..000
--- a/graphite/graphite2-0.9.2.patch
+++ /dev/null
@@ -1,453 +0,0 @@
-diff -r 5369cdd12120 CMakeLists.txt
 misc/build/graphite2-0.9.2/CMakeLists.txt	Sat Feb 12 22:54:16 2011 +0700
-+++ misc/build/graphite2-0.9.2/CMakeLists.txt	Fri Feb 18 16:05:40 2011 +0700
-@@ -61,7 +61,7 @@
- add_subdirectory(gr2fonttest)
- add_subdirectory(tests)
- add_subdirectory(doc)
--set(version 0.0.0)
-+set(version 2.0.0)
- set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
- set(includedir ${CMAKE_INSTALL_PREFIX}/include)
- 
-diff -r 5369cdd12120 gr2fonttest/gr2FontTest.cpp
 misc/build/graphite2-0.9.2/gr2fonttest/gr2FontTest.cpp	Sat Feb 12 22:54:16 2011 +0700
-+++ misc/build/graphite2-0.9.2/gr2fonttest/gr2FontTest.cpp	Fri Feb 18 16:05:40 2011 +0700
-@@ -758,13 +758,11 @@
- float advanceWidth = gr_seg_advance_X(pSeg);
- fprintf(log, Advance width = %6.1f\n, advanceWidth);
- unsigned int numchar = gr_seg_n_cinfo(pSeg);
--gr_uint32 *firsts = (gr_uint32 *)malloc(numchar * sizeof(gr_uint32));
--gr_uint32 *lasts = (gr_uint32 *)malloc(numchar * sizeof(gr_uint32));
--gr_seg_char_slots(pSeg, firsts, lasts, 0, 0);
- fprintf(log, \nChar\tUnicode\tBefore\tAfter\n);
- for (unsigned int j = 0; j  numchar; j++)
- {
--fprintf(log, %d\t%04X\t%d\t%d\n, j, gr_cinfo_unicode_char(gr_seg_cinfo(pSeg, j)), firsts[j], lasts[j]);
-+const gr_char_info *c = gr_seg_cinfo(pSeg, j);
-+fprintf(log, %d\t%04X\t%d\t%d\n, j, gr_cinfo_unicode_char(c), gr_cinfo_before(c), gr_cinfo_after(c));
- }
- free(map);
- gr_seg_destroy(pSeg);
-diff -r 5369cdd12120 include/graphite2/Segment.h
 misc/build/graphite2-0.9.2/include/graphite2/Segment.h	Sat Feb 12 22:54:16 2011 +0700
-+++ misc/build/graphite2-0.9.2/include/graphite2/Segment.h	Fri Feb 18 16:05:40 2011 +0700
-@@ -135,6 +135,20 @@
-   */
- GR2_API int gr_cinfo_break_weight(const gr_char_info* p/*not NULL*/);
- 
-+/** Returns the slot index that after this character is after in the slot stream
-+  *
-+  * @return after slot index between 0 and gr_seg_n_slots()
-+  * @param p Pointer to charinfo to return information on.
-+  */
-+GR2_API int gr_cinfo_after(const gr_char_info* p/*not NULL*/);
-+
-+/** Returns the slot index that before this character is before in the slot stream
-+  *
-+  * @return before slot index between 0 and gr_seg_n_slots()
-+  * @param p Pointer to charinfo to return information on.
-+  */
-+GR2_API int gr_cinfo_before(const gr_char_info* p/*not NULL*/);
-+
- /** Returns the number of unicode characters in a string.
-   *
-   * @return number of characters in the string
-@@ -205,22 +219,6 @@
-   */
- GR2_API const gr_slot* gr_seg_last_slot(gr_segment* pSeg/*not NULL*/);//may give a base slot or a slot which is attached to another
- 
--/** Calculates the underlying character to glyph associations.
--  *
--  * @param pSeg  Pointer to the segment we want information on.
--  * @param begins An array of gr_seg_n_cinfo integers giving slot index for each
--  *   charinfo. The value corresponds to which slot a cursor would be before
--  *   if an underlying cursor were before the charinfo at this index.
--  * @param ends  An array of gr_seg_n_cinfo 

[Libreoffice] Graphite 1.0.1

2011-08-11 Thread Martin Hosken
This is a library pull request.

Please could someone upload 
http://sourceforge.net/projects/silgraphite/files/graphite2/graphite2-1.0.1.tgz/download
 to htp://download.go-oo.org/src I will then submit a patch to integrate the 
graphite2 release into libo (simplifying the existing patches, no other code 
changes).

TIA,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] Android versions that we will compile LO for

2011-06-06 Thread Martin Hosken

 I am working with 2 other great individuals in regards to bring LO to 
 android devices. The sdk has support for android version 1.5 all the way 
 up to the latest 3.1
 
 Question becomes what versions do we want to get cross compilation to 
 work with?

Having just come off a low level android project, I would suggest you target 
2.3 as your earliest, at least until you have it working. Anything before that 
is fraught with problems and your mileage as to whether anything will work will 
vary.

Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Android versions that we will compile LO for

2011-06-06 Thread Martin Hosken
Dear Rodrigo,

 Our plans is to make an LibO version for tablets. Of course, Android API
 make it possible to tablet apps run on smartphones as well, but it affects
 our target version.
 
 Jonathan, I think it'd be better to target 3.0 for now. I think that most of
 the Android tablets will run 3.1 but, let's stick with 3.0 until we have
 good reasons to increase our minimum version. What do you think?

Thanks for letting me revise my suggestion. Yes I think 3.0 as the minimum 
without crying if you have to go to 3.1 is the best course of action. 3.1 is in 
too much flux at the moment, so I wouldn't start there. And yes, it's pointless 
going back to 2.x because you are a tablet app.

Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] graphite2 bug #36703 signoff request

2011-05-16 Thread Martin Hosken
Please can someone signoff on bug #36703 against the fixes for 3.4 release. 
I've upgraded to the current source (0.9.4) base with fixes in the patches 
specific to this bug. Details in the bug and checked them in on the 3.4 branch.

TIA,
Martin Hosken
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] alternative fix for #36703

2011-05-16 Thread Martin Hosken
Enclosed is a patch which doesn't involve an update to the graphite2 tarball. 
This patch fixes bug #36703 for the extreme pressure LinLibertineG puts on 
graphite. For more details, see the bug itself.

Yours,
Martin
diff --git a/graphite/graphite2-0.9.2.patch b/graphite/graphite2-0.9.2.patch
index 35f0bd2..a775c1f 100644
--- a/graphite/graphite2-0.9.2.patch
+++ b/graphite/graphite2-0.9.2.patch
@@ -402,3 +402,52 @@ diff current src/List.h
#ifdef GR2_EXPORTING
  #ifdef __GNUC__
#define GR2_API__attribute__((dllexport))
+diff -r b3a86877ec68 src/Pass.cpp
+--- misc/build/graphite2-0.9.2/src/Pass.cpp	Wed May 11 09:34:52 2011 +0700
 misc/build/graphite2-0.9.2/src/Pass.cpp	Mon May 16 13:54:00 2011 +0700
+@@ -513,6 +513,7 @@
+ bool Pass::testConstraint(const Rule r, Machine  m) const
+ {
+ if (r.sort - r.preContext  (int)m.slotMap().size() - m.slotMap().context())return false;
++if (m.slotMap().context() - r.preContext  0) return false;
+ if (!*r.constraint) return true;
+ assert(r.constraint-constraint());
+ 
+@@ -527,6 +528,7 @@
+ Machine::status_t status = Machine::finished;
+ for (int n = r.sort; n  map; --n, ++map)
+ {
++	if (!*map) continue;
+ const int32 ret = r.constraint-run(m, map, status);
+ if (!ret || status != Machine::finished)
+ {
+diff -r b3a86877ec68 src/Rule.h
+--- misc/build/graphite2-0.9.2/src/Rule.h	Wed May 11 09:34:52 2011 +0700
 misc/build/graphite2-0.9.2/src/Rule.h	Mon May 16 13:54:00 2011 +0700
+@@ -187,8 +187,9 @@
+   // Merge the new sorted rules list into the current sorted result set.
+   const RuleEntry * lre = begin(), * rre = state.rules;
+   RuleEntry * out = m_rules + (m_begin == m_rules)*MAX_RULES;
++  const RuleEntry * lrend = out + MAX_RULES;
+   m_begin = out; 
+-  while (lre != end())
++  while (lre != end()  out != lrend)
+   {
+ if (*lre  *rre)  *out++ = *lre++;
+ else if (*rre  *lre) { *out++ = *rre++; }
+@@ -196,12 +197,12 @@
+ 
+ if (rre == state.rules_end) 
+ { 
+-  while (lre != end()) { *out++ = *lre++; }
++  while (lre != end()  out != lrend) { *out++ = *lre++; }
+   m_end = out;
+   return;
+ }
+   }
+-  while (rre != state.rules_end) { *out++ = *rre++; }
++  while (rre != state.rules_end  out != lrend) { *out++ = *rre++; }
+   m_end = out;
+ }
+ 
+
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] fixing kashida insertion

2011-03-15 Thread Martin Hosken
Dear Arabic experts,

The current kashida insertion implementation in libo is, to put it mildly, a 
disaster. As I see it there are a few options open to us:

1. Get it right. This is really hard and beyond my capabilities in the time I 
have available for this. But if someone wants to work out the preferred 
location for each word and then insert there, then go for it.

2. Implement dumb kashida placement that says: you can insert a kashida at any 
joining of two characters. This should be doable (famous last words) based on 
Unicode properties.

3. Don't do kashida insertion at all. This is probably better than the bad 
insertion we currently have.

I'm willing to have a go at 2 or 3. An alternative would be to add a switch in 
say Options/Language Settings/Writing Aids/Options or Options/Language 
Settings/Complex Text Layout to enable/disable kashida insertion. Such UI stuff 
is beyond me at the moment.

I'm also not an arabic expert or really have any feelings on the matter.

What would the arabic dev community suggest?

Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] Add ICU 4.6 to services.openoffice.org

2011-03-09 Thread Martin Hosken
Could someone copy 
http://download.icu-project.org/files/icu4c/4.6/icu4c-4_6-src.tgz to 
http://hg.services.openoffice.org/binaries/43e56b71c407be5154de681eaa646a4a-icu4c-4_6-src.tgz

I ask this in anticipation of merging the gr2 branch.

TIA,
Yours,
Martin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice