summaryrefslogtreecommitdiff
path: root/vcl/source/glyphs/gcach_layout.cxx
blob: 424ebddff87c0d967dc31dbf1c0e8ec92e5d7e3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
#define ENABLE_ICU_LAYOUT

/*************************************************************************
 *
 *  $RCSfile: gcach_layout.cxx,v $
 *
 *  $Revision: 1.4 $
 *  last change: $Author: hdu $ $Date: 2002-04-23 12:31:34 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#if !defined(_SV_SALUNX_HXX) && !defined(WIN32)
#include <salunx.h>
#endif

#ifndef _SV_GCACHFTYP_HXX
#include <gcach_ftyp.hxx>
#endif

#ifndef _SV_SALLAYOUT_HXX
#include <sallayout.hxx>
#endif

#ifdef WIN32
#include <malloc.h>
#define alloca _alloca
#elif !defined(FREEBSD) && !defined(NETBSD)
#include <alloca.h>
#endif

#ifdef DEBUG
#include <cstdio>
#endif

// =======================================================================

ServerFontLayout::ServerFontLayout( ServerFont* pServerFont,
    const ImplLayoutArgs& rArgs )
:   GenericSalLayout( rArgs ),
    mpServerFont( pServerFont )
{}

// =======================================================================
// Layout Engine Abstract Base Class
// =======================================================================

class ServerFontLayoutEngine
{
public:
    virtual ServerFontLayout*   operator()( ServerFont*, const ImplLayoutArgs& rArgs );
};

static ServerFontLayoutEngine aSimpleLayoutEngine;

// =======================================================================
// layout implementation for ServerFont
// =======================================================================

bool ServerFont::InitLayoutEngine()
{
    // setup default layout engine
    mpLayoutData = (void*)&aSimpleLayoutEngine;
    return true;
}

// -----------------------------------------------------------------------

void ServerFont::DoneLayoutEngine()
{
    ServerFontLayoutEngine* pLE = (ServerFontLayoutEngine*)mpLayoutData;
    if( (pLE != NULL) && (pLE != &aSimpleLayoutEngine) )
        delete pLE;
    mpLayoutData = NULL;
}

// -----------------------------------------------------------------------

ServerFontLayout* ServerFont::LayoutText( const ImplLayoutArgs& rLayoutArgs )
{
    ServerFontLayoutEngine* pLE = NULL;
    if( !(rLayoutArgs.mnFlags & SAL_LAYOUT_COMPLEX_DISABLED) )
    {
        if( !mpLayoutData )
            InitLayoutEngine();
        pLE = (ServerFontLayoutEngine*)mpLayoutData;
    }
    if( !pLE )
        pLE = &aSimpleLayoutEngine;

    ServerFontLayout* pSalLayout = (*pLE)( this, rLayoutArgs );
    if( rLayoutArgs.mpDXArray )
        pSalLayout->ApplyDXArray( rLayoutArgs.mpDXArray );
    if( rLayoutArgs.mnLayoutWidth )
        pSalLayout->Justify( rLayoutArgs.mnLayoutWidth );
    return pSalLayout;
}

// -----------------------------------------------------------------------

ServerFontLayout* ServerFontLayoutEngine::operator()( ServerFont* pFont,
    const ImplLayoutArgs& rArgs )
{
    bool bRightToLeft = (SAL_LAYOUT_BIDI_RTL & rArgs.mnFlags) != 0;

    int nGlyphCount = rArgs.mnEndCharIndex - rArgs.mnFirstCharIndex;
    GlyphItem* pGlyphBuffer = new GlyphItem[ nGlyphCount ];

    Point aNewPos( 0, 0 );
    bool bWantFallback = false;
    int nOldGlyphId = -1;
    for( int i = 0; i < nGlyphCount; ++i )
    {
        int nLogicalIndex = bRightToLeft ? rArgs.mnEndCharIndex-1-i : rArgs.mnFirstCharIndex+i;
        int nGlyphIndex = pFont->GetGlyphIndex( rArgs.mpStr[ nLogicalIndex ] );
        if( !nGlyphIndex )
            bWantFallback = true;

        if( SAL_LAYOUT_KERNING_PAIRS & rArgs.mnFlags )
        {
            int nKern = pFont->GetGlyphKernValue( nOldGlyphId, nGlyphIndex );
            aNewPos += Point( nKern, 0 );
            nOldGlyphId = nGlyphIndex;
        }
        // TODO: apply asian kerning if requested too

        const GlyphMetric& rGM = pFont->GetGlyphMetric( nGlyphIndex );
        int nGlyphWidth = rGM.GetCharWidth();
        pGlyphBuffer[i] = GlyphItem( nLogicalIndex, nGlyphIndex, aNewPos,
            GlyphItem::CLUSTER_START, nGlyphWidth );

        aNewPos += Point( nGlyphWidth, 0 );
    }

    ServerFontLayout* pSalLayout = new ServerFontLayout( pFont, rArgs );
    pSalLayout->SetGlyphItems( pGlyphBuffer, nGlyphCount );
    pSalLayout->SetWantFallback( bWantFallback );
    return pSalLayout;
}

// =======================================================================
// bridge to ICU LayoutEngine
// =======================================================================

#ifdef ENABLE_ICU_LAYOUT

#define bool_t signed char
#include <layout/LayoutEngine.h>
#include <layout/LEFontInstance.h>
#include <layout/LEScripts.h>
#include <unicode/uscript.h>

using namespace icu_2_0;

// -----------------------------------------------------------------------

class IcuFontFromServerFont
: public LEFontInstance
{
private:
    FreetypeServerFont* const mpServerFont;

public:
                            IcuFontFromServerFont( FreetypeServerFont* pFont )
                            : mpServerFont(pFont)
                            {}

    virtual const void*     getFontTable(LETag tableTag) const;
    virtual le_bool         canDisplay(LEUnicode32 ch) const;
    virtual le_int32        getUnitsPerEM() const;


    virtual void            mapCharsToGlyphs( const LEUnicode chars[],
                                le_int32 offset, le_int32 count, le_bool reverse,
                                const LECharMapper* mapper, LEGlyphID glyphs[] ) const;
    virtual LEGlyphID       mapCharToGlyph( LEUnicode32 ch, const LECharMapper* mapper) const;

    virtual le_int32        getName( le_uint16 platformID, le_uint16 scriptID, le_uint16 languageID,
                                le_uint16 nameID, LEUnicode *name ) const;
    virtual void            getGlyphAdvance( LEGlyphID glyph, LEPoint &advance ) const;
    virtual le_bool         getGlyphPoint( LEGlyphID glyph, le_int32 pointNumber, LEPoint& point ) const;
    virtual float           getXPixelsPerEm() const;
    virtual float           getYPixelsPerEm() const;
    virtual float           xUnitsToPoints( float xUnits ) const;
    virtual float           yUnitsToPoints( float xUnits ) const;
    virtual void            unitsToPoints( LEPoint &units, LEPoint &points ) const;
    virtual float           xPixelsToUnits( float xPixels ) const;
    virtual float           yPixelsToUnits( float xPixels ) const;
    virtual void            pixelsToUnits( LEPoint &pixels, LEPoint &units ) const;
    virtual void            transformFunits( float xFunits, float yFunits, LEPoint &pixels ) const;
};



// -----------------------------------------------------------------------

const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const
{
    char pTagName[5];
    pTagName[0] = (char)(nICUTableTag >> 24);
    pTagName[1] = (char)(nICUTableTag >> 16);
    pTagName[2] = (char)(nICUTableTag >>  8);
    pTagName[3] = (char)(nICUTableTag);
    pTagName[4] = 0;

    ULONG nLength;
    const unsigned char* pBuffer = mpServerFont->GetTable( pTagName, &nLength );
#ifdef DEBUG
    fprintf(stderr,"IcuGetTable(\"%s\") => %p\n",pTagName,pBuffer);
#endif
    return (const void*)pBuffer;
}

// -----------------------------------------------------------------------

le_bool IcuFontFromServerFont::canDisplay( LEUnicode32 ch ) const
{
    le_bool rc = (mpServerFont->GetRawGlyphIndex( ch ) != 0);
    return rc;
}

// -----------------------------------------------------------------------

le_int32 IcuFontFromServerFont::getUnitsPerEM() const
{
    return mpServerFont->GetEmUnits();
}

// -----------------------------------------------------------------------

void IcuFontFromServerFont::mapCharsToGlyphs( const LEUnicode pChars[],
    le_int32 nOffset, le_int32 nCount, le_bool bReverse,
    const LECharMapper* pMapper, LEGlyphID pGlyphs[] ) const
{
    for( int i = 0; i < nCount; ++i )
        pGlyphs[i] = mapCharToGlyph( pChars[nOffset+i], pMapper );

    if( bReverse )
    {
        for( LEGlyphID *p1=pGlyphs, *p2=p1+nCount; p1 < --p2; ++p1 )
        {
            LEGlyphID t = *p1; *p1 = *p2; *p2 = t;
        }
    }
}

// -----------------------------------------------------------------------

LEGlyphID IcuFontFromServerFont::mapCharToGlyph( LEUnicode32 ch,
    const LECharMapper* /*TODO: mapper*/ ) const
{
    LEGlyphID nGlyphIndex = mpServerFont->GetRawGlyphIndex( ch );
    return nGlyphIndex;
}


// -----------------------------------------------------------------------
le_int32 IcuFontFromServerFont::getName(
    le_uint16 platformID, le_uint16 scriptID, le_uint16 languageID,
    le_uint16 nameID, LEUnicode *name ) const
{
    //TODO: replace dummy implementation
    if( name )
        name[0] = '#';
    return 1;
}

// -----------------------------------------------------------------------

void IcuFontFromServerFont::getGlyphAdvance( LEGlyphID nGlyphIndex,
    LEPoint &advance ) const
{
    const GlyphMetric& rGM = mpServerFont->GetGlyphMetric( nGlyphIndex );
    advance.fX = rGM.GetCharWidth();
    advance.fY = 0;
}

// -----------------------------------------------------------------------

le_bool IcuFontFromServerFont::getGlyphPoint( LEGlyphID glyph,
    le_int32 pointNumber, LEPoint& point ) const
{
    //TODO: replace dummy implementation
#ifdef DEBUG
    fprintf(stderr,"getGlyphPoint\n");
#endif
    return false;
}

// -----------------------------------------------------------------------

float IcuFontFromServerFont::getXPixelsPerEm() const
{
    const ImplFontSelectData& r = mpServerFont->GetFontSelData();
    float fX = r.mnWidth ? r.mnWidth : r.mnHeight;
#ifdef DEBUG
    fprintf(stderr,"mnWidth %d\n",(int)fX);
#endif
    return fX;
}

// -----------------------------------------------------------------------

float IcuFontFromServerFont::getYPixelsPerEm() const
{
    float fY = mpServerFont->GetFontSelData().mnHeight;
#ifdef DEBUG
    fprintf(stderr,"mnHeight %d\n",(int)fY);
#endif
    return fY;
}

// -----------------------------------------------------------------------

float IcuFontFromServerFont::xUnitsToPoints( float xUnits ) const
{
#ifdef DEBUG
    fprintf(stderr,"xu2p\n");
#endif
    // assumption: pixels==points
    float fPoints = xUnits;
    fPoints *= mpServerFont->GetFontSelData().mnWidth;
    fPoints /= mpServerFont->GetEmUnits();
    return fPoints;
}

// -----------------------------------------------------------------------

float IcuFontFromServerFont::yUnitsToPoints( float yUnits ) const
{
#ifdef DEBUG
    fprintf(stderr,"yu2p\n");
#endif
    // assumption: pixels==points
    float fPoints = yUnits;
    fPoints *= mpServerFont->GetFontSelData().mnHeight;
    fPoints /= mpServerFont->GetEmUnits();
    return fPoints;
}

// -----------------------------------------------------------------------

void IcuFontFromServerFont::unitsToPoints( LEPoint &units, LEPoint &points ) const
{
#ifdef DEBUG
    fprintf(stderr,"pu2p\n");
#endif
    points.fX = xUnitsToPoints( units.fX );
    points.fY = yUnitsToPoints( units.fY );
}

// -----------------------------------------------------------------------

float IcuFontFromServerFont::xPixelsToUnits( float xPixels ) const
{
#ifdef DEBUG
    fprintf(stderr,"xp2u\n");
#endif
    float fPixels = xPixels;
    fPixels *= mpServerFont->GetEmUnits();
    fPixels /= mpServerFont->GetFontSelData().mnWidth;
    return fPixels;
}

// -----------------------------------------------------------------------

float IcuFontFromServerFont::yPixelsToUnits( float yPixels ) const
{
#ifdef DEBUG
    fprintf(stderr,"yp2u\n");
#endif
    float fPixels = yPixels;
    fPixels *= mpServerFont->GetEmUnits();
    fPixels /= mpServerFont->GetFontSelData().mnHeight;
    return fPixels;
}

// -----------------------------------------------------------------------

void IcuFontFromServerFont::pixelsToUnits( LEPoint &pixels, LEPoint &units ) const
{
#ifdef DEBUG
    fprintf(stderr,"pp2u\n");
#endif
    units.fX = xPixelsToUnits( pixels.fX );
    units.fY = yPixelsToUnits( pixels.fY );
}

// -----------------------------------------------------------------------

void IcuFontFromServerFont::transformFunits( float xFunits, float yFunits, LEPoint &pixels ) const
{
#ifdef DEBUG
    fprintf(stderr,"tfu\n");
#endif
    //TODO: replace dummy implementation
    Point aOrig( (int)(xFunits + 0.5), (int)(yFunits + 0.5) );
    Point aDest = mpServerFont->TransformPoint( aOrig );
    pixels.fX = aDest.X();
    pixels.fY = aDest.Y();
}

// =======================================================================

class IcuLayoutEngine : public ServerFontLayoutEngine
{
private:
    IcuFontFromServerFont   maIcuFont;

    le_int32                meScriptCode;
    LayoutEngine*           mpIcuLE;

public:
                            IcuLayoutEngine( FreetypeServerFont* pServerFont );
    virtual                 ~IcuLayoutEngine();
    bool                    IsReady() const { return (mpIcuLE != NULL); }

    virtual ServerFontLayout* operator()( ServerFont*, const ImplLayoutArgs& );
};

// -----------------------------------------------------------------------

IcuLayoutEngine::IcuLayoutEngine( FreetypeServerFont* pServerFont )
:   maIcuFont( pServerFont ),
    mpIcuLE( NULL ),
    meScriptCode( USCRIPT_INVALID_CODE )
{}

// -----------------------------------------------------------------------

IcuLayoutEngine::~IcuLayoutEngine()
{
    if( mpIcuLE )
        delete mpIcuLE;
}

// -----------------------------------------------------------------------

ServerFontLayout* IcuLayoutEngine::operator()( ServerFont* pFont,
    const ImplLayoutArgs& rArgs )
{
    LEUnicode* pIcuChars;
    if( sizeof(LEUnicode) == sizeof(*rArgs.mpStr) )
        pIcuChars = (LEUnicode*)rArgs.mpStr;
    else
    {
        // this conversion will only be needed when either
        // ICU's or OOo's unicodes stop being unsigned shorts
        // TODO: watch out for surrogates!
        pIcuChars = (LEUnicode*)alloca( rArgs.mnLength * sizeof(LEUnicode) );
        for( xub_StrLen ic = 0; ic < rArgs.mnLength; ++ic )
            pIcuChars[ic] = static_cast<LEUnicode>( rArgs.mpStr[ic] );
    }

    UErrorCode rcI18n = U_ZERO_ERROR;
    LEErrorCode rcIcu = LE_NO_ERROR;

    // find matching script
    // TODO: handle errors better
    // TODO: consider script changes
    le_int32 eScriptCode = uscript_getScript( pIcuChars[0], &rcI18n );

    // get layout engine matching to this script
    // no engine change necessary if script is latin
    if( (meScriptCode != eScriptCode)
    &&   (eScriptCode > USCRIPT_INHERITED)
    &&   (eScriptCode != latnScriptCode) )
    {
        // TODO: cache multiple layout engines when multiple scripts are used
        delete mpIcuLE;
        meScriptCode = eScriptCode;
        le_int32 eLangCode = 0;
        mpIcuLE = LayoutEngine::layoutEngineFactory( &maIcuFont, eScriptCode, eLangCode, rcIcu );
        if( LE_FAILURE(rcIcu) )
        {
            delete mpIcuLE;
            mpIcuLE = NULL;
        }
    }

    // fall back to default layout if needed
    if( !mpIcuLE )
        return aSimpleLayoutEngine( pFont, rArgs );

    // TODO: split up BiDi runs
    le_bool bRightToLeft = (SAL_LAYOUT_BIDI_RTL & rArgs.mnFlags) != 0;

    // run ICU layout engine
    int nGlyphCount = mpIcuLE->layoutChars( pIcuChars, rArgs.mnFirstCharIndex,
        rArgs.mnEndCharIndex - rArgs.mnFirstCharIndex, rArgs.mnLength,
        bRightToLeft, 0.0, 0.0, rcIcu );
    if( LE_FAILURE(rcIcu) )
        return NULL;

    // import layout info from icu
    struct IcuPosition{ float fX, fY; };
    LEGlyphID* pIcuGlyphs = (LEGlyphID*)alloca( nGlyphCount * sizeof(LEGlyphID) );
    le_int32* pCharIndices = (le_int32*)alloca( nGlyphCount * sizeof(le_int32) );
    IcuPosition* pGlyphPositions = (IcuPosition*)alloca( (nGlyphCount+1) * sizeof(IcuPosition) );

    mpIcuLE->getGlyphs( pIcuGlyphs, rcIcu );
    mpIcuLE->getCharIndices( pCharIndices, rcIcu );
    mpIcuLE->getGlyphPositions( (float*)pGlyphPositions, rcIcu );
    mpIcuLE->reset();
    if( LE_FAILURE(rcIcu) )
        return NULL;

    // export layout info to ServerFontLayout
    GlyphItem* pGlyphBuffer = new GlyphItem[ nGlyphCount ];
    bool bWantFallback = false;

    Point aNewPos;
    const IcuPosition* pPos = pGlyphPositions;
    FreetypeServerFont* pFtFont = reinterpret_cast<FreetypeServerFont*>(pFont);
    for( int i = 0; i < nGlyphCount; ++i, ++pPos )
    {
        //TODO: remove workaround below for ICU getting pCharIndex wrong
        int nCharIndex = rArgs.mnFirstCharIndex + pCharIndices[i];
        int nGlyphIndex = pIcuGlyphs[i];
        if( nGlyphIndex != 0 )
        {
            // apply vertical flags, etc.
            sal_Unicode aChar = rArgs.mpStr[ pCharIndices[ i ] ];
            nGlyphIndex = pFtFont->FixupGlyphIndex( nGlyphIndex, aChar );
        }
        else
            bWantFallback = true;

        aNewPos = Point( (int)(pPos->fX+0.5), (int)(pPos->fY+0.5) );
        const GlyphMetric& rGM = pFont->GetGlyphMetric( nGlyphIndex );
        int nGlyphWidth = rGM.GetCharWidth();
        pGlyphBuffer[i] = GlyphItem( nCharIndex, nGlyphIndex, aNewPos,
            GlyphItem::CLUSTER_START, nGlyphWidth );
        //TODO: apply kerning if requested, set MOVED flag
    }
    aNewPos = Point( (int)(pPos->fX+0.5), (int)(pPos->fY+0.5) );

    ServerFontLayout* pSalLayout = new ServerFontLayout( pFont, rArgs );
    pSalLayout->SetGlyphItems( pGlyphBuffer, nGlyphCount );
    pSalLayout->SetWantFallback( bWantFallback );
    return pSalLayout;
}

#endif // ENABLE_ICU_LAYOUT

// =======================================================================

bool FreetypeServerFont::InitLayoutEngine()
{
    // find best layout engine for font, platform, script and language
#ifdef ENABLE_ICU_LAYOUT
    IcuLayoutEngine* pLE = new IcuLayoutEngine( this );
    mpLayoutData = (void*)pLE;
#endif // ENABLE_ICU_LAYOUT

    return (mpLayoutData != NULL);
}

// =======================================================================