View | Details | Raw Unified | Return to issue 112730
Collapse All | Expand All

(-)a/graphite/makefile.mk (-6 / +11 lines)
Lines 51-57 Link Here
51
51
52
# convert line-endings to avoid problems when patching
52
# convert line-endings to avoid problems when patching
53
CONVERTFILES=\
53
CONVERTFILES=\
54
	engine/makefile.vc8
54
	engine/makefile.vc8 \
55
	engine/test/RegressionTest/RtTextSrc.h
55
56
56
#.IF "$(OS)"=="WNT" && "$(COM)"!="GCC"
57
#.IF "$(OS)"=="WNT" && "$(COM)"!="GCC"
57
#CONFIGURE_DIR=win32
58
#CONFIGURE_DIR=win32
Lines 72-85 Link Here
72
BUILD_ACTION=nmake VERBOSE=1
73
BUILD_ACTION=nmake VERBOSE=1
73
.IF "$(debug)"=="true"
74
.IF "$(debug)"=="true"
74
BUILD_FLAGS= "CFG=DEBUG"
75
BUILD_FLAGS= "CFG=DEBUG"
76
CFLAGSWITHPATH= $(CFLAGS:s!-Fd.!-Fd../../../../../!)
77
.ELSE
78
# Speed Optimization is really needed for Graphite
79
CFLAGSWITHPATH= $(CFLAGS) /O2
75
.ENDIF
80
.ENDIF
76
### convert CFLAGS as cl.exe cannot handle OOO"s generic ones directly
81
### convert CFLAGS as cl.exe cannot handle OOO"s generic ones directly
77
### TODO: use "guw.exe" instead?
82
### TODO: use "guw.exe" instead?
78
ALLCFLAGS= $(CFLAGS) $(CFLAGSCXX) $(CFLAGSEXCEPTIONS) $(CDEFS)
83
ALLCFLAGS= $(CFLAGSWITHPATH) $(CFLAGSCXX) $(CFLAGSEXCEPTIONS) $(CDEFS)
79
JUSTASLASH= /
84
JUSTASLASH= /
80
CFLAGS2MSC= $(ALLCFLAGS:s/-Z/$(JUSTASLASH)Z/)
85
CFLAGS2MSC= $(ALLCFLAGS:s/-Z/$(JUSTASLASH)Z/)
81
CFLAGS4MSC= $(CFLAGS2MSC:s/ -/ $(JUSTASLASH)/)
86
CFLAGS4MSC= $(CFLAGS2MSC:s/ -/ $(JUSTASLASH)/)
82
BUILD_FLAGS+= "MLIB=MD" "CFLAGS4MSC=$(CFLAGS4MSC)" /F makefile.vc$(VCNUM) dll
87
BUILD_FLAGS+= "CFLAGS4MSC=$(CFLAGS4MSC)" /F makefile.vc$(VCNUM) lib_dll
83
.ENDIF
88
.ENDIF
84
89
85
.IF "$(COM)"=="GCC"
90
.IF "$(COM)"=="GCC"
Lines 138-148 Link Here
138
#OUT2LIB+=engine$/src$/.libs$/libgraphite*.dll
143
#OUT2LIB+=engine$/src$/.libs$/libgraphite*.dll
139
.IF "$(debug)"=="true"
144
.IF "$(debug)"=="true"
140
OUT2BIN= \
145
OUT2BIN= \
141
    engine$/debug$/*.dll \
146
#    engine$/debug$/*.dll \
142
    engine$/debug$/*.pdb
147
    engine$/debug$/*.pdb
143
.ELSE
148
.ELSE
144
OUT2BIN= \
149
OUT2BIN=
145
    engine$/release$/*.dll
150
#    engine$/release$/*.dll
146
#    engine$/release$/*.pdb
151
#    engine$/release$/*.pdb
147
.ENDIF
152
.ENDIF
148
.ELSE
153
.ELSE
(-)a/vcl/inc/vcl/graphite_adaptors.hxx (-2 / +2 lines)
Lines 86-93 Link Here
86
//
86
//
87
class VCL_DLLPUBLIC GraphiteFontAdaptor : public gr::Font
87
class VCL_DLLPUBLIC GraphiteFontAdaptor : public gr::Font
88
{
88
{
89
typedef std::map<const gr::gid16, std::pair<gr::Rect, gr::Point> > GlyphMetricMap;
89
    typedef std::map<const gr::gid16, std::pair<gr::Rect, gr::Point> > GlyphMetricMap;
90
90
    friend class GrFontHasher;
91
public:
91
public:
92
    static bool    IsGraphiteEnabledFont(ServerFont &) throw();
92
    static bool    IsGraphiteEnabledFont(ServerFont &) throw();
93
93
(-)a/vcl/inc/vcl/graphite_cache.hxx (-7 / +27 lines)
Lines 105-119 Link Here
105
*/
105
*/
106
class GraphiteSegmentCache
106
class GraphiteSegmentCache
107
{
107
{
108
public:
108
  enum {
109
  enum {
109
    // not really sure what good values are here,
110
    // not really sure what good values are here,
110
    // bucket size should be >> cache size
111
    // bucket size should be >> cache size
111
    SEG_BUCKET_SIZE = 4096,
112
    SEG_BUCKET_FACTOR = 4,
112
    SEG_CACHE_SIZE = 255
113
    SEG_DEFAULT_CACHE_SIZE = 2047
113
  };
114
  };
114
public:
115
  GraphiteSegmentCache(sal_uInt32 nSegCacheSize)
115
  GraphiteSegmentCache()
116
    : m_segMap(nSegCacheSize * SEG_BUCKET_FACTOR),
116
    : m_segMap(SEG_BUCKET_SIZE),
117
	m_nSegCacheSize(nSegCacheSize),
117
    m_oldestKey(NULL) {};
118
    m_oldestKey(NULL) {};
118
  ~GraphiteSegmentCache()
119
  ~GraphiteSegmentCache()
119
  {
120
  {
Lines 224-229 Link Here
224
private:
225
private:
225
  GraphiteSegMap m_segMap;
226
  GraphiteSegMap m_segMap;
226
  GraphiteRopeMap m_ropeMap;
227
  GraphiteRopeMap m_ropeMap;
228
  sal_uInt32 m_nSegCacheSize;
227
  const xub_Unicode * m_oldestKey;
229
  const xub_Unicode * m_oldestKey;
228
  const xub_Unicode * m_prevKey;
230
  const xub_Unicode * m_prevKey;
229
};
231
};
Lines 236-242 Link Here
236
class GraphiteCacheHandler
238
class GraphiteCacheHandler
237
{
239
{
238
public:
240
public:
239
  GraphiteCacheHandler() : m_cacheMap(255) {};
241
  GraphiteCacheHandler() : m_cacheMap(255)
242
  {
243
	const char * pEnvCache = getenv( "SAL_GRAPHITE_CACHE_SIZE" );
244
	if (pEnvCache != NULL)
245
	{
246
		int envCacheSize = atoi(pEnvCache);
247
		if (envCacheSize <= 0)
248
			m_nSegCacheSize = GraphiteSegmentCache::SEG_DEFAULT_CACHE_SIZE;
249
		else
250
		{
251
			m_nSegCacheSize = envCacheSize;
252
		}
253
	}
254
	else
255
	{
256
		m_nSegCacheSize = GraphiteSegmentCache::SEG_DEFAULT_CACHE_SIZE;
257
	}
258
  };
240
  ~GraphiteCacheHandler()
259
  ~GraphiteCacheHandler()
241
  {
260
  {
242
    GraphiteCacheMap::iterator i = m_cacheMap.begin();
261
    GraphiteCacheMap::iterator i = m_cacheMap.begin();
Lines 257-268 Link Here
257
    {
276
    {
258
      return m_cacheMap.find(fontHash)->second;
277
      return m_cacheMap.find(fontHash)->second;
259
    }
278
    }
260
    GraphiteSegmentCache *pCache = new GraphiteSegmentCache();
279
    GraphiteSegmentCache *pCache = new GraphiteSegmentCache(m_nSegCacheSize);
261
    m_cacheMap[fontHash] = pCache;
280
    m_cacheMap[fontHash] = pCache;
262
    return pCache;
281
    return pCache;
263
  }
282
  }
264
private:
283
private:
265
  GraphiteCacheMap m_cacheMap;
284
  GraphiteCacheMap m_cacheMap;
285
  sal_uInt32 m_nSegCacheSize;
266
};
286
};
267
287
268
#endif
288
#endif
(-)a/vcl/inc/vcl/graphite_layout.hxx (-1 / +14 lines)
Lines 65-70 Link Here
65
class GrSegRecord;
65
class GrSegRecord;
66
// SAL/VCL types
66
// SAL/VCL types
67
class ServerFont;
67
class ServerFont;
68
69
#ifdef WNT
70
// The GraphiteWinFont is just a wrapper to enable GrFontHasher to be a friend
71
// so that UniqueCacheInfo can be called.
72
#include <graphite/WinFont.h>
73
class GraphiteWinFont : public gr::WinFont
74
{
75
    friend class GrFontHasher;
76
public:
77
    GraphiteWinFont(HDC hdc) : gr::WinFont(hdc) {};
78
    virtual ~GraphiteWinFont() {};
79
};
80
#endif
68
// Graphite types
81
// Graphite types
69
namespace gr { class Segment; class GlyphIterator; }
82
namespace gr { class Segment; class GlyphIterator; }
70
namespace grutils { class GrFeatureParser; }
83
namespace grutils { class GrFeatureParser; }
Lines 98-104 Link Here
98
        iterator_pair_t    neighbour_clusters(const_iterator) const;
111
        iterator_pair_t    neighbour_clusters(const_iterator) const;
99
    private:
112
    private:
100
        std::pair<float,float> appendCluster(gr::Segment & rSeg, ImplLayoutArgs & rArgs,
113
        std::pair<float,float> appendCluster(gr::Segment & rSeg, ImplLayoutArgs & rArgs,
101
            bool bRtl, int nFirstCharInCluster, int nNextChar,
114
            bool bRtl, float fSegmentAdvance, int nFirstCharInCluster, int nNextChar,
102
            int nFirstGlyphInCluster, int nNextGlyph, float fScaling,
115
            int nFirstGlyphInCluster, int nNextGlyph, float fScaling,
103
            std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char,
116
            std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char,
104
            std::vector<int> & rCharDxs, long & rDXOffset);
117
            std::vector<int> & rCharDxs, long & rDXOffset);
(-)a/vcl/source/glyphs/graphite_adaptors.cxx (-21 / +31 lines)
Lines 99-110 Link Here
99
            fItalic = false;
99
            fItalic = false;
100
    }
100
    }
101
101
102
    // Get the font name.
102
    // Get the font name, but prefix with file name hash in case
103
    // there are 2 fonts on the system with the same face name
104
    sal_Int32 nHashCode = font.GetFontFileName()->hashCode();
105
    ::rtl::OUStringBuffer nHashFaceName;
106
    nHashFaceName.append(nHashCode, 16);
103
    const sal_Unicode    * name = font.GetFontSelData().maName.GetBuffer();
107
    const sal_Unicode    * name = font.GetFontSelData().maName.GetBuffer();
104
    const size_t          name_sz = std::min(sizeof szFaceName/sizeof(wchar_t)-1,
108
    nHashFaceName.append(name);
105
                    size_t(font.GetFontSelData().maName.Len()));
106
109
107
    std::copy(name, name + name_sz, szFaceName);
110
    const size_t name_sz = std::min(sizeof szFaceName/sizeof(wchar_t)-1,
111
                    static_cast<size_t>(nHashFaceName.getLength()));
112
113
    std::copy(nHashFaceName.getStr(), nHashFaceName.getStr() + name_sz, szFaceName);
108
    szFaceName[name_sz] = '\0';
114
    szFaceName[name_sz] = '\0';
109
}
115
}
110
116
Lines 120-132 Link Here
120
    mfEmUnits(static_cast<FreetypeServerFont &>(sfont).GetMetricsFT().y_ppem),
126
    mfEmUnits(static_cast<FreetypeServerFont &>(sfont).GetMetricsFT().y_ppem),
121
    mpFeatures(NULL)
127
    mpFeatures(NULL)
122
{
128
{
123
    //std::wstring face_name(maFontProperties.szFaceName);
124
    const rtl::OString aLang = MsLangId::convertLanguageToIsoByteString( sfont.GetFontSelData().meLanguage );
129
    const rtl::OString aLang = MsLangId::convertLanguageToIsoByteString( sfont.GetFontSelData().meLanguage );
125
#ifdef DEBUG
126
    printf("GraphiteFontAdaptor %lx\n", (long)this);
127
#endif
128
    rtl::OString name = rtl::OUStringToOString(
130
    rtl::OString name = rtl::OUStringToOString(
129
        sfont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 );
131
        sfont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 );
132
#ifdef DEBUG
133
    printf("GraphiteFontAdaptor %lx %s italic=%u bold=%u\n", (long)this, name.getStr(),
134
           maFontProperties.fItalic, maFontProperties.fBold);
135
#endif
130
    sal_Int32 nFeat = name.indexOf(grutils::GrFeatureParser::FEAT_PREFIX) + 1;
136
    sal_Int32 nFeat = name.indexOf(grutils::GrFeatureParser::FEAT_PREFIX) + 1;
131
    if (nFeat > 0)
137
    if (nFeat > 0)
132
    {
138
    {
Lines 259-279 Link Here
259
// Return the glyph's metrics in pixels.
265
// Return the glyph's metrics in pixels.
260
void GraphiteFontAdaptor::getGlyphMetrics(gr::gid16 nGlyphId, gr::Rect & aBounding, gr::Point & advances)
266
void GraphiteFontAdaptor::getGlyphMetrics(gr::gid16 nGlyphId, gr::Rect & aBounding, gr::Point & advances)
261
{
267
{
262
    // Graphite gets really confused if the glyphs have been transformed, so
268
    // There used to be problems when orientation was set however, this no
263
    // if orientation has been set we can't use the font's glyph cache
269
    // longer seems to be the case and the Glyph Metric cache in
264
    // unfortunately the font selection data, doesn't always have the orientation
270
    // FreetypeServerFont is more efficient since it lasts between calls to VCL
265
    // set, even if it was when the glyphs were cached, so we use our own cache.
271
#if 1
272
    const GlyphMetric & metric = mrFont.GetGlyphMetric(nGlyphId);
266
273
267
//         const GlyphMetric & metric = mrFont.GetGlyphMetric(nGlyphId);
274
    aBounding.right  = aBounding.left = metric.GetOffset().X();
268
//
275
    aBounding.bottom = aBounding.top  = -metric.GetOffset().Y();
269
//         aBounding.right  = aBounding.left = metric.GetOffset().X();
276
    aBounding.right  += metric.GetSize().Width();
270
//         aBounding.bottom = aBounding.top  = -metric.GetOffset().Y();
277
    aBounding.bottom -= metric.GetSize().Height();
271
//         aBounding.right  += metric.GetSize().Width();
272
//         aBounding.bottom -= metric.GetSize().Height();
273
//
274
//         advances.x = metric.GetDelta().X();
275
//         advances.y = -metric.GetDelta().Y();
276
278
279
    advances.x = metric.GetDelta().X();
280
    advances.y = -metric.GetDelta().Y();
281
282
#else
283
    // The problem with the code below is that the cache only lasts
284
    // as long as the life time of the GraphiteFontAdaptor, which
285
    // is created once per call to X11SalGraphics::GetTextLayout
277
    GlyphMetricMap::const_iterator gm_itr = maGlyphMetricMap.find(nGlyphId);
286
    GlyphMetricMap::const_iterator gm_itr = maGlyphMetricMap.find(nGlyphId);
278
    if (gm_itr != maGlyphMetricMap.end())
287
    if (gm_itr != maGlyphMetricMap.end())
279
    {
288
    {
Lines 321-326 Link Here
321
        // Now add an entry to our metrics map.
330
        // Now add an entry to our metrics map.
322
        maGlyphMetricMap[nGlyphId] = std::make_pair(aBounding, advances);
331
        maGlyphMetricMap[nGlyphId] = std::make_pair(aBounding, advances);
323
    }
332
    }
333
#endif
324
}
334
}
325
335
326
#endif
336
#endif
(-)a/vcl/source/glyphs/graphite_cache.cxx (-4 / +4 lines)
Lines 51-63 Link Here
51
    : m_rope(rope), m_text(textSrc), m_seg(seg), m_nextKey(NULL),
51
    : m_rope(rope), m_text(textSrc), m_seg(seg), m_nextKey(NULL),
52
    m_fontScale(0.0f), mbIsRtl(bIsRtl), m_lockCount(0)
52
    m_fontScale(0.0f), mbIsRtl(bIsRtl), m_lockCount(0)
53
{
53
{
54
	m_pStr = textSrc->getLayoutArgs().mpStr + seg->startCharacter();
54
    m_pStr = textSrc->getLayoutArgs().mpStr + seg->startCharacter();
55
	m_startChar = seg->startCharacter();
55
    m_startChar = seg->startCharacter();
56
}
56
}
57
57
58
GrSegRecord::~GrSegRecord()
58
GrSegRecord::~GrSegRecord()
59
{
59
{
60
	clear();
60
    clear();
61
}
61
}
62
62
63
void GrSegRecord::reuse(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl)
63
void GrSegRecord::reuse(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl)
Lines 105-111 Link Here
105
    // when the next key is added, the record for the prevKey's m_nextKey field
105
    // when the next key is added, the record for the prevKey's m_nextKey field
106
    // is updated to the newest key so that m_oldestKey can be updated to the
106
    // is updated to the newest key so that m_oldestKey can be updated to the
107
    // next oldest key when the record for m_oldestKey is deleted
107
    // next oldest key when the record for m_oldestKey is deleted
108
    if (m_segMap.size() > SEG_CACHE_SIZE)
108
    if (m_segMap.size() > m_nSegCacheSize)
109
    {
109
    {
110
      GraphiteSegMap::iterator oldestPair = m_segMap.find(reinterpret_cast<long>(m_oldestKey));
110
      GraphiteSegMap::iterator oldestPair = m_segMap.find(reinterpret_cast<long>(m_oldestKey));
111
      // oldest record may no longer exist if a buffer was changed
111
      // oldest record may no longer exist if a buffer was changed
(-)a/vcl/source/glyphs/graphite_layout.cxx (-19 / +48 lines)
Lines 56-61 Link Here
56
#include <svsys.h>
56
#include <svsys.h>
57
#endif
57
#endif
58
58
59
#ifdef UNX
60
#include <vcl/graphite_adaptors.hxx>
61
#endif
62
59
#include <vcl/salgdi.hxx>
63
#include <vcl/salgdi.hxx>
60
64
61
#include <unicode/uchar.h>
65
#include <unicode/uchar.h>
Lines 175-181 Link Here
175
    glyph_range_t iGlyphs = rSegment.glyphs();
179
    glyph_range_t iGlyphs = rSegment.glyphs();
176
    int nGlyphs = iGlyphs.second - iGlyphs.first;
180
    int nGlyphs = iGlyphs.second - iGlyphs.first;
177
    gr::GlyphIterator prevBase = iGlyphs.second;
181
    gr::GlyphIterator prevBase = iGlyphs.second;
178
    float fMinX = rSegment.advanceWidth();
182
    float fSegmentAdvance = rSegment.advanceWidth();
183
    float fMinX = fSegmentAdvance;
179
    float fMaxX = 0.0f;
184
    float fMaxX = 0.0f;
180
    rGlyph2Char.assign(nGlyphs, -1);
185
    rGlyph2Char.assign(nGlyphs, -1);
181
    long nDxOffset = 0;
186
    long nDxOffset = 0;
Lines 222-228 Link Here
222
                        nFirstGlyphInCluster != nGlyphIndex)
227
                        nFirstGlyphInCluster != nGlyphIndex)
223
                    {
228
                    {
224
                        std::pair <float,float> aBounds =
229
                        std::pair <float,float> aBounds =
225
                            appendCluster(rSegment, rArgs, bRtl, nFirstCharInCluster,
230
                            appendCluster(rSegment, rArgs, bRtl,
231
                            fSegmentAdvance, nFirstCharInCluster,
226
                            nNextChar, nFirstGlyphInCluster, nGlyphIndex, fScaling,
232
                            nNextChar, nFirstGlyphInCluster, nGlyphIndex, fScaling,
227
                            rChar2Base, rGlyph2Char, rCharDxs, nDxOffset);
233
                            rChar2Base, rGlyph2Char, rCharDxs, nDxOffset);
228
                        fMinX = std::min(aBounds.first, fMinX);
234
                        fMinX = std::min(aBounds.first, fMinX);
Lines 285-291 Link Here
285
        nFirstGlyphInCluster != nGlyphIndex)
291
        nFirstGlyphInCluster != nGlyphIndex)
286
    {
292
    {
287
        std::pair <float,float> aBounds =
293
        std::pair <float,float> aBounds =
288
            appendCluster(rSegment, rArgs, bRtl, nFirstCharInCluster, nNextChar,
294
            appendCluster(rSegment, rArgs, bRtl, fSegmentAdvance,
295
                          nFirstCharInCluster, nNextChar,
289
                          nFirstGlyphInCluster, nGlyphIndex, fScaling,
296
                          nFirstGlyphInCluster, nGlyphIndex, fScaling,
290
                          rChar2Base, rGlyph2Char, rCharDxs, nDxOffset);
297
                          rChar2Base, rGlyph2Char, rCharDxs, nDxOffset);
291
        fMinX = std::min(aBounds.first, fMinX);
298
        fMinX = std::min(aBounds.first, fMinX);
Lines 334-344 Link Here
334
    }
341
    }
335
}
342
}
336
343
337
std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg,
344
std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment& rSeg,
338
    ImplLayoutArgs & rArgs, bool bRtl, int nFirstCharInCluster, int nNextChar,
345
    ImplLayoutArgs & rArgs, bool bRtl,float fSegmentAdvance,
339
    int nFirstGlyphInCluster, int nNextGlyph, float fScaling,
346
    int nFirstCharInCluster, int nNextChar, int nFirstGlyphInCluster,
340
    std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char,
347
    int nNextGlyph, float fScaling, std::vector<int> & rChar2Base,
341
    std::vector<int> & rCharDxs, long & rDXOffset)
348
    std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs, long & rDXOffset)
342
{
349
{
343
    glyph_range_t iGlyphs = rSeg.glyphs();
350
    glyph_range_t iGlyphs = rSeg.glyphs();
344
    int nGlyphs = iGlyphs.second - iGlyphs.first;
351
    int nGlyphs = iGlyphs.second - iGlyphs.first;
Lines 402-410 Link Here
402
        gr::GlyphInfo aGlyph = *(iGlyphs.first + j);
409
        gr::GlyphInfo aGlyph = *(iGlyphs.first + j);
403
        if (j + nDelta >= nGlyphs || j + nDelta < 0) // at rhs ltr,rtl
410
        if (j + nDelta >= nGlyphs || j + nDelta < 0) // at rhs ltr,rtl
404
        {
411
        {
405
            fNextOrigin = rSeg.advanceWidth();
412
            fNextOrigin = fSegmentAdvance;
406
            nNextOrigin = round(rSeg.advanceWidth() * fScaling + rDXOffset);
413
            nNextOrigin = round(fSegmentAdvance * fScaling + rDXOffset);
407
            aBounds.second = std::max(rSeg.advanceWidth(), aBounds.second);
414
            aBounds.second = std::max(fSegmentAdvance, aBounds.second);
408
        }
415
        }
409
        else
416
        else
410
        {
417
        {
Lines 546-552 Link Here
546
    // If true, it can cause end of line spaces to be hidden e.g. Doulos SIL
553
    // If true, it can cause end of line spaces to be hidden e.g. Doulos SIL
547
    maLayout.setStartOfLine(false);
554
    maLayout.setStartOfLine(false);
548
    maLayout.setEndOfLine(false);
555
    maLayout.setEndOfLine(false);
549
//    maLayout.setDumbFallback(false);
556
    maLayout.setDumbFallback(true);
550
    // trailing ws doesn't seem to always take affect if end of line is true
557
    // trailing ws doesn't seem to always take affect if end of line is true
551
    maLayout.setTrailingWs(gr::ktwshAll);
558
    maLayout.setTrailingWs(gr::ktwshAll);
552
#ifdef GRLAYOUT_DEBUG
559
#ifdef GRLAYOUT_DEBUG
Lines 598-603 Link Here
598
    else delete pSegment;
605
    else delete pSegment;
599
#else
606
#else
600
    gr::Segment * pSegment = CreateSegment(rArgs);
607
    gr::Segment * pSegment = CreateSegment(rArgs);
608
    if (!pSegment)
609
        return false;
601
    bool success = LayoutGlyphs(rArgs, pSegment);
610
    bool success = LayoutGlyphs(rArgs, pSegment);
602
    delete pSegment;
611
    delete pSegment;
603
#endif
612
#endif
Lines 649-655 Link Here
649
#endif
658
#endif
650
        return hash;
659
        return hash;
651
    };
660
    };
652
661
protected:
662
    virtual void UniqueCacheInfo(std::wstring & stuFace, bool & fBold, bool & fItalic)
663
    {
664
#ifdef WIN32
665
        dynamic_cast<GraphiteWinFont&>(mrRealFont).UniqueCacheInfo(stuFace, fBold, fItalic);
666
#else
667
#ifdef UNX
668
        dynamic_cast<GraphiteFontAdaptor&>(mrRealFont).UniqueCacheInfo(stuFace, fBold, fItalic);
669
#else
670
#error Unknown base type for gr::Font::UniqueCacheInfo
671
#endif
672
#endif
673
    }
653
private:
674
private:
654
    gr::Font & mrRealFont;
675
    gr::Font & mrRealFont;
655
};
676
};
Lines 738-743 Link Here
738
        }
759
        }
739
        else
760
        else
740
        {
761
        {
762
#ifdef GRLAYOUT_DEBUG
763
            fprintf(grLog(), "Gr::LayoutText failed: ");
764
            for (int i = mnMinCharPos; i < limit; i++)
765
            {
766
                fprintf(grLog(), "%04x ", rArgs.mpStr[i]);
767
            }
768
            fprintf(grLog(), "\n");
769
#endif
741
            clear();
770
            clear();
742
            return NULL;
771
            return NULL;
743
        }
772
        }
Lines 897-903 Link Here
897
                if (i > 0) pDXArray[i] -= mvCharDxs[i-1];
926
                if (i > 0) pDXArray[i] -= mvCharDxs[i-1];
898
            }
927
            }
899
#ifdef GRLAYOUT_DEBUG
928
#ifdef GRLAYOUT_DEBUG
900
            fprintf(grLog(),"%d,%d,%ld ", (int)i, (int)mvCharDxs[i], pDXArray[i]);
929
            fprintf(grLog(),"%d,%d,%d ", (int)i, (int)mvCharDxs[i], pDXArray[i]);
901
#endif
930
#endif
902
        }
931
        }
903
        //std::adjacent_difference(mvCharDxs.begin(), mvCharDxs.end(), pDXArray);
932
        //std::adjacent_difference(mvCharDxs.begin(), mvCharDxs.end(), pDXArray);
Lines 1020-1026 Link Here
1020
1049
1021
#ifdef GRLAYOUT_DEBUG
1050
#ifdef GRLAYOUT_DEBUG
1022
    for (size_t iDx = 0; iDx < mvCharDxs.size(); iDx++)
1051
    for (size_t iDx = 0; iDx < mvCharDxs.size(); iDx++)
1023
         fprintf(grLog(),"%d,%d,%ld ", (int)iDx, (int)mvCharDxs[iDx], args.mpDXArray[iDx]);
1052
         fprintf(grLog(),"%d,%d,%d ", (int)iDx, (int)mvCharDxs[iDx], args.mpDXArray[iDx]);
1024
    fprintf(grLog(),"ApplyDx\n");
1053
    fprintf(grLog(),"ApplyDx\n");
1025
#endif
1054
#endif
1026
    bool bRtl = mnLayoutFlags & SAL_LAYOUT_BIDI_RTL;
1055
    bool bRtl = mnLayoutFlags & SAL_LAYOUT_BIDI_RTL;
Lines 1090-1096 Link Here
1090
            }
1119
            }
1091
            long nDWidth = nNewClusterWidth - nOrigClusterWidth;
1120
            long nDWidth = nNewClusterWidth - nOrigClusterWidth;
1092
#ifdef GRLAYOUT_DEBUG
1121
#ifdef GRLAYOUT_DEBUG
1093
            fprintf(grLog(), "c%d last glyph %d/%d\n", i, nLastGlyph, mvGlyphs.size());
1122
            fprintf(grLog(), "c%lu last glyph %d/%lu\n", i, nLastGlyph, mvGlyphs.size());
1094
#endif
1123
#endif
1095
            assert((nLastGlyph > -1) && (nLastGlyph < (signed)mvGlyphs.size()));
1124
            assert((nLastGlyph > -1) && (nLastGlyph < (signed)mvGlyphs.size()));
1096
            mvGlyphs[nLastGlyph].mnNewWidth += nDWidth;
1125
            mvGlyphs[nLastGlyph].mnNewWidth += nDWidth;
Lines 1128-1134 Link Here
1128
    std::copy(args.mpDXArray, args.mpDXArray + nChars,
1157
    std::copy(args.mpDXArray, args.mpDXArray + nChars,
1129
      mvCharDxs.begin() + (args.mnMinCharPos - mnMinCharPos));
1158
      mvCharDxs.begin() + (args.mnMinCharPos - mnMinCharPos));
1130
#ifdef GRLAYOUT_DEBUG
1159
#ifdef GRLAYOUT_DEBUG
1131
    fprintf(grLog(),"ApplyDx %ld(%ld)\n", args.mpDXArray[nChars - 1], mnWidth);
1160
    fprintf(grLog(),"ApplyDx %d(%ld)\n", args.mpDXArray[nChars - 1], mnWidth);
1132
#endif
1161
#endif
1133
    mnWidth = args.mpDXArray[nChars - 1];
1162
    mnWidth = args.mpDXArray[nChars - 1];
1134
}
1163
}
Lines 1170-1176 Link Here
1170
        }
1199
        }
1171
        nKashidaCount = 1 + (nGapWidth / nKashidaWidth);
1200
        nKashidaCount = 1 + (nGapWidth / nKashidaWidth);
1172
#ifdef GRLAYOUT_DEBUG
1201
#ifdef GRLAYOUT_DEBUG
1173
        printf("inserting %d kashidas at %ld\n", nKashidaCount, (*i).mnGlyphIndex);
1202
        printf("inserting %d kashidas at %u\n", nKashidaCount, (*i).mnGlyphIndex);
1174
#endif
1203
#endif
1175
        GlyphItem glyphItem = *i;
1204
        GlyphItem glyphItem = *i;
1176
        Point aPos(0, 0);
1205
        Point aPos(0, 0);
Lines 1309-1315 Link Here
1309
            pCaretXArray[i] = pCaretXArray[i+1] = 0;
1338
            pCaretXArray[i] = pCaretXArray[i+1] = 0;
1310
        }
1339
        }
1311
#ifdef GRLAYOUT_DEBUG
1340
#ifdef GRLAYOUT_DEBUG
1312
        fprintf(grLog(),"%d,%ld-%ld\t", nCharSlot, pCaretXArray[i], pCaretXArray[i+1]);
1341
        fprintf(grLog(),"%d,%d-%d\t", nCharSlot, pCaretXArray[i], pCaretXArray[i+1]);
1313
#endif
1342
#endif
1314
    }
1343
    }
1315
#ifdef GRLAYOUT_DEBUG
1344
#ifdef GRLAYOUT_DEBUG
(-)a/vcl/source/glyphs/graphite_textsrc.hxx (+1 lines)
Lines 93-98 Link Here
93
        virtual ext_std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
93
        virtual ext_std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
94
        virtual size_t  getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
94
        virtual size_t  getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
95
        virtual bool    sameSegment(gr::toffset ich1, gr::toffset ich2);
95
        virtual bool    sameSegment(gr::toffset ich1, gr::toffset ich2);
96
        virtual bool featureVariations() { return false; }
96
97
97
        operator ImplLayoutArgs & () throw();
98
        operator ImplLayoutArgs & () throw();
98
        void setFeatures(const grutils::GrFeatureParser * pFeatures);
99
        void setFeatures(const grutils::GrFeatureParser * pFeatures);
(-)a/vcl/win/source/gdi/winlayout.cxx (-1 / +1 lines)
Lines 2821-2827 Link Here
2821
class GraphiteWinLayout : public WinLayout
2821
class GraphiteWinLayout : public WinLayout
2822
{
2822
{
2823
private:
2823
private:
2824
    mutable gr::WinFont   mpFont;
2824
    mutable GraphiteWinFont mpFont;
2825
    grutils::GrFeatureParser * mpFeatures;
2825
    grutils::GrFeatureParser * mpFeatures;
2826
    mutable GraphiteLayoutWinImpl maImpl;
2826
    mutable GraphiteLayoutWinImpl maImpl;
2827
public:
2827
public:

Return to issue 112730