1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_vcl.hxx"
26 
27 // We need this to enable namespace support in libgrengine headers.
28 #define GR_NAMESPACE
29 
30 // Header files
31 //
32 
33 // Platform
34 #include <sallayout.hxx>
35 // Module
36 #include "gcach_ftyp.hxx"
37 #include <graphite_features.hxx>
38 #include "graphite_textsrc.hxx"
39 #include <graphite_serverfont.hxx>
40 
41 #ifndef WNT
42 
43 //
44 // An implementation of the GraphiteLayout interface to enable Graphite enabled fonts to be used.
45 //
46 
GraphiteServerFontLayout(GraphiteFontAdaptor * pFont)47 GraphiteServerFontLayout::GraphiteServerFontLayout(GraphiteFontAdaptor * pFont) throw()
48   : ServerFontLayout(pFont->font()), mpFont(pFont),
49     maImpl(*mpFont, mpFont->features(), pFont)
50 {
51     // Nothing needed here
52 }
53 
~GraphiteServerFontLayout()54 GraphiteServerFontLayout::~GraphiteServerFontLayout() throw()
55 {
56     delete mpFont;
57     mpFont = NULL;
58 }
59 
getTextPtr() const60 const sal_Unicode* GraphiteServerFontLayout::getTextPtr() const
61 {
62     return maImpl.textSrc()->getLayoutArgs().mpStr +
63         maImpl.textSrc()->getLayoutArgs().mnMinCharPos;
64 }
65 
getKashidaGlyph(int & width)66 sal_GlyphId GraphiteLayoutImpl::getKashidaGlyph(int & width)
67 {
68     int nKashidaIndex = mpFont->font().GetGlyphIndex( 0x0640 );
69     if( nKashidaIndex != 0 )
70     {
71         const GlyphMetric& rGM = mpFont->font().GetGlyphMetric( nKashidaIndex );
72         width = rGM.GetCharWidth();
73     }
74     else
75     {
76         width = 0;
77     }
78     return nKashidaIndex;
79 }
80 
81 #endif
82