1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_vcl.hxx"
30 
31 // We need this to enable namespace support in libgrengine headers.
32 #define GR_NAMESPACE
33 
34 // Header files
35 //
36 
37 // Platform
38 #include <sallayout.hxx>
39 // Module
40 #include "gcach_ftyp.hxx"
41 #include <graphite_features.hxx>
42 #include "graphite_textsrc.hxx"
43 #include <graphite_serverfont.hxx>
44 
45 #ifndef WNT
46 
47 //
48 // An implementation of the GraphiteLayout interface to enable Graphite enabled fonts to be used.
49 //
50 
51 GraphiteServerFontLayout::GraphiteServerFontLayout(GraphiteFontAdaptor * pFont) throw()
52   : ServerFontLayout(pFont->font()), mpFont(pFont),
53     maImpl(*mpFont, mpFont->features(), pFont)
54 {
55     // Nothing needed here
56 }
57 
58 GraphiteServerFontLayout::~GraphiteServerFontLayout() throw()
59 {
60     delete mpFont;
61     mpFont = NULL;
62 }
63 
64 const sal_Unicode* GraphiteServerFontLayout::getTextPtr() const
65 {
66     return maImpl.textSrc()->getLayoutArgs().mpStr +
67         maImpl.textSrc()->getLayoutArgs().mnMinCharPos;
68 }
69 
70 sal_GlyphId GraphiteLayoutImpl::getKashidaGlyph(int & width)
71 {
72     int nKashidaIndex = mpFont->font().GetGlyphIndex( 0x0640 );
73     if( nKashidaIndex != 0 )
74     {
75         const GlyphMetric& rGM = mpFont->font().GetGlyphMetric( nKashidaIndex );
76         width = rGM.GetCharWidth();
77     }
78     else
79     {
80         width = 0;
81     }
82     return nKashidaIndex;
83 }
84 
85 #endif
86