xref: /aoo41x/main/vcl/inc/outfont.hxx (revision 161f4cd1)
1*161f4cd1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*161f4cd1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*161f4cd1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*161f4cd1SAndrew Rist  * distributed with this work for additional information
6*161f4cd1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*161f4cd1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*161f4cd1SAndrew Rist  * "License"); you may not use this file except in compliance
9*161f4cd1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*161f4cd1SAndrew Rist  *
11*161f4cd1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*161f4cd1SAndrew Rist  *
13*161f4cd1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*161f4cd1SAndrew Rist  * software distributed under the License is distributed on an
15*161f4cd1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*161f4cd1SAndrew Rist  * KIND, either express or implied.  See the License for the
17*161f4cd1SAndrew Rist  * specific language governing permissions and limitations
18*161f4cd1SAndrew Rist  * under the License.
19*161f4cd1SAndrew Rist  *
20*161f4cd1SAndrew Rist  *************************************************************/
21*161f4cd1SAndrew Rist 
22*161f4cd1SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_OUTFONT_HXX
25cdf0e10cSrcweir #define _SV_OUTFONT_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/string.hxx>
28cdf0e10cSrcweir #include <tools/list.hxx>
29cdf0e10cSrcweir #include <i18npool/lang.h>
30cdf0e10cSrcweir #include <tools/gen.hxx>
31cdf0e10cSrcweir #include <tools/solar.h>
32cdf0e10cSrcweir #include <vcl/dllapi.h>
33cdf0e10cSrcweir #include <unotools/fontdefs.hxx>
34cdf0e10cSrcweir #include <vcl/vclenum.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <hash_map>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class ImplDevFontListData;
39cdf0e10cSrcweir class ImplGetDevFontList;
40cdf0e10cSrcweir class ImplGetDevSizeList;
41cdf0e10cSrcweir class ImplFontEntry;
42cdf0e10cSrcweir class ImplDirectFontSubstitution;
43cdf0e10cSrcweir class ImplPreMatchFontSubstitution;
44cdf0e10cSrcweir class ImplGlyphFallbackFontSubstitution;
45cdf0e10cSrcweir class ImplFontSelectData;
46cdf0e10cSrcweir class Font;
47cdf0e10cSrcweir class ConvertChar;
48cdf0e10cSrcweir struct FontMatchStatus;
49cdf0e10cSrcweir class OutputDevice;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace lang { struct Locale; }}}}
52cdf0e10cSrcweir 
53cdf0e10cSrcweir // ----------------------
54cdf0e10cSrcweir // - ImplFontAttributes -
55cdf0e10cSrcweir // ----------------------
56cdf0e10cSrcweir // device independent font properties
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class ImplFontAttributes
59cdf0e10cSrcweir {
60cdf0e10cSrcweir public: // TODO: create matching interface class
GetFamilyName() const61cdf0e10cSrcweir     const String&   GetFamilyName() const   { return maName; }
GetStyleName() const62cdf0e10cSrcweir     const String&   GetStyleName() const    { return maStyleName; }
GetWeight() const63cdf0e10cSrcweir     FontWeight      GetWeight() const       { return meWeight; }
GetSlant() const64cdf0e10cSrcweir     FontItalic      GetSlant() const        { return meItalic; }
GetFamilyType() const65cdf0e10cSrcweir     FontFamily      GetFamilyType() const   { return meFamily; }
GetPitch() const66cdf0e10cSrcweir     FontPitch       GetPitch() const        { return mePitch; }
GetWidthType() const67cdf0e10cSrcweir     FontWidth       GetWidthType() const    { return meWidthType; }
IsSymbolFont() const68cdf0e10cSrcweir     bool            IsSymbolFont() const    { return mbSymbolFlag; }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir public: // TODO: hide members behind accessor methods
71cdf0e10cSrcweir     String          maName;         // Font Family Name
72cdf0e10cSrcweir     String          maStyleName;    // Font Style Name
73cdf0e10cSrcweir     FontWeight      meWeight;       // Weight Type
74cdf0e10cSrcweir     FontItalic      meItalic;       // Slant Type
75cdf0e10cSrcweir     FontFamily      meFamily;       // Family Type
76cdf0e10cSrcweir     FontPitch       mePitch;        // Pitch Type
77cdf0e10cSrcweir     FontWidth       meWidthType;    // Width Type
78cdf0e10cSrcweir     bool            mbSymbolFlag;
79cdf0e10cSrcweir };
80cdf0e10cSrcweir 
81cdf0e10cSrcweir // -------------------------
82cdf0e10cSrcweir // - ImplDevFontAttributes -
83cdf0e10cSrcweir // -------------------------
84cdf0e10cSrcweir // device dependent font properties
85cdf0e10cSrcweir 
86cdf0e10cSrcweir class ImplDevFontAttributes : public ImplFontAttributes
87cdf0e10cSrcweir {
88cdf0e10cSrcweir public: // TODO: create matching interface class
GetAliasNames() const89cdf0e10cSrcweir     const String&      GetAliasNames() const     { return maMapNames; }
GetQuality() const90cdf0e10cSrcweir     int                GetQuality() const        { return mnQuality; }
IsRotatable() const91cdf0e10cSrcweir     bool               IsRotatable() const       { return mbOrientation; }
IsDeviceFont() const92cdf0e10cSrcweir     bool               IsDeviceFont() const      { return mbDevice; }
IsEmbeddable() const93cdf0e10cSrcweir     bool               IsEmbeddable() const      { return mbEmbeddable; }
IsSubsettable() const94cdf0e10cSrcweir     bool               IsSubsettable() const     { return mbSubsettable; }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir public: // TODO: hide members behind accessor methods
97cdf0e10cSrcweir     String             maMapNames;       // List of family name aliass separated with ';'
98cdf0e10cSrcweir     int                mnQuality;        // Quality (used when similar fonts compete)
99cdf0e10cSrcweir     bool               mbOrientation;    // true: physical font can be rotated
100cdf0e10cSrcweir     bool               mbDevice;         // true: built in font
101cdf0e10cSrcweir     bool               mbSubsettable;    // true: a subset of the font can be created
102cdf0e10cSrcweir     bool               mbEmbeddable;     // true: the font can be embedded
103cdf0e10cSrcweir };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir // ----------------
106cdf0e10cSrcweir // - ImplFontData -
107cdf0e10cSrcweir // ----------------
108cdf0e10cSrcweir // TODO: rename ImplFontData to PhysicalFontFace
109cdf0e10cSrcweir // TODO: no more direct access to members
110cdf0e10cSrcweir // TODO: add reference counting
111cdf0e10cSrcweir // TODO: get rid of height/width for scalable fonts
112cdf0e10cSrcweir // TODO: make cloning cheaper
113cdf0e10cSrcweir 
114cdf0e10cSrcweir // abstract base class for physical font faces
115cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC ImplFontData : public ImplDevFontAttributes
116cdf0e10cSrcweir {
117cdf0e10cSrcweir public:
118cdf0e10cSrcweir     // by using an ImplFontData object as a factory for its corresponding
119cdf0e10cSrcweir     // ImplFontEntry an ImplFontEntry can be extended to cache device and
120cdf0e10cSrcweir     // font instance specific data
121cdf0e10cSrcweir     virtual ImplFontEntry*  CreateFontInstance( ImplFontSelectData& ) const = 0;
122cdf0e10cSrcweir 
GetHeight() const123cdf0e10cSrcweir     virtual int             GetHeight() const           { return mnHeight; }
GetWidth() const124cdf0e10cSrcweir     virtual int             GetWidth() const            { return mnWidth; }
125cdf0e10cSrcweir     virtual sal_IntPtr      GetFontId() const = 0;
GetFontMagic() const126cdf0e10cSrcweir     int                     GetFontMagic() const        { return mnMagic; }
IsScalable() const127cdf0e10cSrcweir     bool                    IsScalable() const          { return (mnHeight == 0); }
CheckMagic(int n) const128cdf0e10cSrcweir     bool                    CheckMagic( int n ) const   { return (n == mnMagic); }
GetNextFace() const129cdf0e10cSrcweir     ImplFontData*           GetNextFace() const         { return mpNext; }
CreateAlias() const130cdf0e10cSrcweir     ImplFontData*           CreateAlias() const         { return Clone(); }
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     bool                    IsBetterMatch( const ImplFontSelectData&, FontMatchStatus& ) const;
133cdf0e10cSrcweir     StringCompare           CompareWithSize( const ImplFontData& ) const;
134cdf0e10cSrcweir     StringCompare           CompareIgnoreSize( const ImplFontData& ) const;
~ImplFontData()135cdf0e10cSrcweir     virtual                 ~ImplFontData() {}
136cdf0e10cSrcweir     virtual ImplFontData*   Clone() const = 0;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir protected:
139cdf0e10cSrcweir     explicit                ImplFontData( const ImplDevFontAttributes&, int nMagic );
SetBitmapSize(int nW,int nH)140cdf0e10cSrcweir     void                    SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     long                    mnWidth;    // Width (in pixels)
143cdf0e10cSrcweir     long                    mnHeight;   // Height (in pixels)
144cdf0e10cSrcweir 
145cdf0e10cSrcweir private:
146cdf0e10cSrcweir friend class ImplDevFontListData;
147cdf0e10cSrcweir     const int               mnMagic;    // poor man's RTTI
148cdf0e10cSrcweir     ImplFontData*           mpNext;
149cdf0e10cSrcweir };
150cdf0e10cSrcweir 
151cdf0e10cSrcweir // ----------------------
152cdf0e10cSrcweir // - ImplFontSelectData -
153cdf0e10cSrcweir // ----------------------
154cdf0e10cSrcweir 
155cdf0e10cSrcweir class ImplFontSelectData : public ImplFontAttributes
156cdf0e10cSrcweir {
157cdf0e10cSrcweir public:
158cdf0e10cSrcweir                         ImplFontSelectData( const Font&, const String& rSearchName,
159cdf0e10cSrcweir                             const Size&, float fExactHeight );
160cdf0e10cSrcweir                         ImplFontSelectData( const ImplFontData&, const Size&,
161cdf0e10cSrcweir                             float fExactHeight, int nOrientation, bool bVertical );
162cdf0e10cSrcweir 
163cdf0e10cSrcweir public: // TODO: change to private
164cdf0e10cSrcweir     String              maTargetName;       // name of the font name token that is chosen
165cdf0e10cSrcweir     String              maSearchName;       // name of the font that matches best
166cdf0e10cSrcweir     int                 mnWidth;            // width of font in pixel units
167cdf0e10cSrcweir     int                 mnHeight;           // height of font in pixel units
168cdf0e10cSrcweir     float               mfExactHeight;       // requested height (in pixels with subpixel details)
169cdf0e10cSrcweir     int                 mnOrientation;      // text orientation in 3600 system
170cdf0e10cSrcweir     LanguageType        meLanguage;         // text language
171cdf0e10cSrcweir     bool                mbVertical;         // vertical mode of requested font
172cdf0e10cSrcweir     bool                mbNonAntialiased;   // true if antialiasing is disabled
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     const ImplFontData* mpFontData;         // a matching ImplFontData object
175cdf0e10cSrcweir     ImplFontEntry*      mpFontEntry;        // pointer to the resulting FontCache entry
176cdf0e10cSrcweir };
177cdf0e10cSrcweir 
178cdf0e10cSrcweir // -------------------
179cdf0e10cSrcweir // - ImplDevFontList -
180cdf0e10cSrcweir // -------------------
181cdf0e10cSrcweir // TODO: merge with ImplFontCache
182cdf0e10cSrcweir // TODO: rename to LogicalFontManager
183cdf0e10cSrcweir 
184cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC ImplDevFontList
185cdf0e10cSrcweir {
186cdf0e10cSrcweir private:
187cdf0e10cSrcweir 	friend class WinGlyphFallbackSubstititution;
188cdf0e10cSrcweir     mutable bool            mbMatchData;    // true if matching attributes are initialized
189cdf0e10cSrcweir     bool                    mbMapNames;     // true if MapNames are available
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     typedef std::hash_map<const String, ImplDevFontListData*,FontNameHash> DevFontList;
192cdf0e10cSrcweir     DevFontList             maDevFontList;
193cdf0e10cSrcweir 
194cdf0e10cSrcweir     ImplPreMatchFontSubstitution* mpPreMatchHook;       // device specific prematch substitution
195cdf0e10cSrcweir     ImplGlyphFallbackFontSubstitution* mpFallbackHook;  // device specific glyh fallback substitution
196cdf0e10cSrcweir 
197cdf0e10cSrcweir public:
198cdf0e10cSrcweir     explicit                ImplDevFontList();
199cdf0e10cSrcweir     virtual                 ~ImplDevFontList();
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     // fill the list with device fonts
202cdf0e10cSrcweir     void                    Add( ImplFontData* );
203cdf0e10cSrcweir     void                    Clear();
Count() const204cdf0e10cSrcweir     int                     Count() const { return maDevFontList.size(); }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir     // find the device font
207cdf0e10cSrcweir     ImplDevFontListData*    FindFontFamily( const String& rFontName ) const;
208cdf0e10cSrcweir     ImplDevFontListData*    ImplFindByFont( ImplFontSelectData&, bool bPrinter, ImplDirectFontSubstitution* ) const;
209cdf0e10cSrcweir     ImplDevFontListData*    ImplFindBySearchName( const String& ) const;
210cdf0e10cSrcweir 
211cdf0e10cSrcweir     // suggest fonts for glyph fallback
212cdf0e10cSrcweir     ImplDevFontListData*    GetGlyphFallbackFont( ImplFontSelectData&,
213cdf0e10cSrcweir 		                rtl::OUString& rMissingCodes, int nFallbackLevel ) const;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     // prepare platform specific font substitutions
216cdf0e10cSrcweir     void                    SetPreMatchHook( ImplPreMatchFontSubstitution* );
217cdf0e10cSrcweir     void                    SetFallbackHook( ImplGlyphFallbackFontSubstitution* );
218cdf0e10cSrcweir 
219cdf0e10cSrcweir     // misc utilities
220cdf0e10cSrcweir     ImplDevFontList*        Clone( bool bScalable, bool bEmbeddable ) const;
221cdf0e10cSrcweir     ImplGetDevFontList*     GetDevFontList() const;
222cdf0e10cSrcweir     ImplGetDevSizeList*     GetDevSizeList( const String& rFontName ) const;
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	//used by 2-level font fallback
225cdf0e10cSrcweir 	ImplDevFontListData* ImplFindByLocale( com::sun::star::lang::Locale& ) const;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir protected:
228cdf0e10cSrcweir     void                    InitMatchData() const;
AreMapNamesAvailable() const229cdf0e10cSrcweir     bool                    AreMapNamesAvailable() const { return mbMapNames; }
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     ImplDevFontListData*    ImplFindByTokenNames( const String& ) const;
232cdf0e10cSrcweir     ImplDevFontListData*    ImplFindByAliasName( const String& rSearchName, const String& rShortName ) const;
233cdf0e10cSrcweir     ImplDevFontListData*    ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const;
234cdf0e10cSrcweir     ImplDevFontListData*    ImplFindByAttributes( sal_uLong nSearchType, FontWeight, FontWidth,
235cdf0e10cSrcweir                                 FontFamily, FontItalic, const String& rSearchFamily ) const;
236cdf0e10cSrcweir     ImplDevFontListData*    FindDefaultFont() const;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir private:
239cdf0e10cSrcweir     void                    InitGenericGlyphFallback() const;
240cdf0e10cSrcweir     mutable ImplDevFontListData**   mpFallbackList;
241cdf0e10cSrcweir     mutable int                     mnFallbackCount;
242cdf0e10cSrcweir };
243cdf0e10cSrcweir 
244cdf0e10cSrcweir // --------------------
245cdf0e10cSrcweir // - ImplKernPairData -
246cdf0e10cSrcweir // --------------------
247cdf0e10cSrcweir // TODO: get rid of ImplKernPairData and use outdev.hxx's KerningPair struct
248cdf0e10cSrcweir // the problem is that outdev.hxx is too high level for the device layers
249cdf0e10cSrcweir // and outdev.hxx's customers depend on KerningPair being defined there
250cdf0e10cSrcweir 
251cdf0e10cSrcweir struct ImplKernPairData
252cdf0e10cSrcweir {
253cdf0e10cSrcweir     sal_uInt16              mnChar1;
254cdf0e10cSrcweir     sal_uInt16              mnChar2;
255cdf0e10cSrcweir     long                mnKern;
256cdf0e10cSrcweir };
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 
259cdf0e10cSrcweir // -----------------------
260cdf0e10cSrcweir // - ImplFontMetricData -
261cdf0e10cSrcweir // -----------------------
262cdf0e10cSrcweir 
263cdf0e10cSrcweir class ImplFontMetricData : public ImplFontAttributes
264cdf0e10cSrcweir {
265cdf0e10cSrcweir public:
266cdf0e10cSrcweir     explicit ImplFontMetricData( const ImplFontSelectData& );
267cdf0e10cSrcweir     void    ImplInitTextLineSize( const OutputDevice* pDev );
268cdf0e10cSrcweir     void    ImplInitAboveTextLineSize();
269cdf0e10cSrcweir 
270cdf0e10cSrcweir public: // TODO: hide members behind accessor methods
271cdf0e10cSrcweir 	// font instance attributes from the font request
272cdf0e10cSrcweir     long                mnWidth;                    // Reference Width
273cdf0e10cSrcweir     short               mnOrientation;              // Rotation in 1/10 degrees
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 	// font metrics measured for the font instance
276cdf0e10cSrcweir     long                mnAscent;                   // Ascent
277cdf0e10cSrcweir     long                mnDescent;                  // Descent
278cdf0e10cSrcweir     long                mnIntLeading;               // Internal Leading
279cdf0e10cSrcweir     long                mnExtLeading;               // External Leading
280cdf0e10cSrcweir     int                 mnSlant;                    // Slant (Italic/Oblique)
281cdf0e10cSrcweir     long                mnMinKashida;               // Minimal width of kashida (Arabic)
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	// font attributes queried from the font instance
284cdf0e10cSrcweir     int                 meFamilyType;               // Font Family Type
285cdf0e10cSrcweir     bool                mbDevice;                   // Flag for Device Fonts
286cdf0e10cSrcweir     bool                mbScalableFont;
287cdf0e10cSrcweir     bool                mbKernableFont;
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 	// font metrics that are usually derived from the measurements
290cdf0e10cSrcweir     long                mnUnderlineSize;            // Lineheight of Underline
291cdf0e10cSrcweir     long                mnUnderlineOffset;          // Offset from Underline to Baseline
292cdf0e10cSrcweir     long                mnBUnderlineSize;           // Hoehe von fetter Unterstreichung
293cdf0e10cSrcweir     long                mnBUnderlineOffset;         // Offset von fetter Unterstreichung zur Baseline
294cdf0e10cSrcweir     long                mnDUnderlineSize;           // Hoehe von doppelter Unterstreichung
295cdf0e10cSrcweir     long                mnDUnderlineOffset1;        // Offset von doppelter Unterstreichung zur Baseline
296cdf0e10cSrcweir     long                mnDUnderlineOffset2;        // Offset von doppelter Unterstreichung zur Baseline
297cdf0e10cSrcweir     long                mnWUnderlineSize;           // Hoehe von WaveLine-Unterstreichung
298cdf0e10cSrcweir     long                mnWUnderlineOffset;         // Offset von WaveLine-Unterstreichung zur Baseline, jedoch zentriert zur WaveLine
299cdf0e10cSrcweir     long                mnAboveUnderlineSize;       // Hoehe von einfacher Unterstreichung (for Vertical Right)
300cdf0e10cSrcweir     long                mnAboveUnderlineOffset;     // Offset von einfacher Unterstreichung zur Baseline (for Vertical Right)
301cdf0e10cSrcweir     long                mnAboveBUnderlineSize;      // Hoehe von fetter Unterstreichung (for Vertical Right)
302cdf0e10cSrcweir     long                mnAboveBUnderlineOffset;    // Offset von fetter Unterstreichung zur Baseline (for Vertical Right)
303cdf0e10cSrcweir     long                mnAboveDUnderlineSize;      // Hoehe von doppelter Unterstreichung (for Vertical Right)
304cdf0e10cSrcweir     long                mnAboveDUnderlineOffset1;   // Offset von doppelter Unterstreichung zur Baseline (for Vertical Right)
305cdf0e10cSrcweir     long                mnAboveDUnderlineOffset2;   // Offset von doppelter Unterstreichung zur Baseline (for Vertical Right)
306cdf0e10cSrcweir     long                mnAboveWUnderlineSize;      // Hoehe von WaveLine-Unterstreichung (for Vertical Right)
307cdf0e10cSrcweir     long                mnAboveWUnderlineOffset;    // Offset von WaveLine-Unterstreichung zur Baseline, jedoch zentriert zur WaveLine (for Vertical Right)
308cdf0e10cSrcweir     long                mnStrikeoutSize;            // Hoehe von einfacher Durchstreichung
309cdf0e10cSrcweir     long                mnStrikeoutOffset;          // Offset von einfacher Durchstreichung zur Baseline
310cdf0e10cSrcweir     long                mnBStrikeoutSize;           // Hoehe von fetter Durchstreichung
311cdf0e10cSrcweir     long                mnBStrikeoutOffset;         // Offset von fetter Durchstreichung zur Baseline
312cdf0e10cSrcweir     long                mnDStrikeoutSize;           // Hoehe von doppelter Durchstreichung
313cdf0e10cSrcweir     long                mnDStrikeoutOffset1;        // Offset von doppelter Durchstreichung zur Baseline
314cdf0e10cSrcweir     long                mnDStrikeoutOffset2;        // Offset von doppelter Durchstreichung zur Baseline
315cdf0e10cSrcweir };
316cdf0e10cSrcweir 
317cdf0e10cSrcweir // -----------------
318cdf0e10cSrcweir // - ImplFontEntry -
319cdf0e10cSrcweir // ------------------
320cdf0e10cSrcweir // TODO: rename ImplFontEntry to LogicalFontInstance
321cdf0e10cSrcweir // TODO: allow sharing of metrics for related fonts
322cdf0e10cSrcweir 
323cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC ImplFontEntry
324cdf0e10cSrcweir {
325cdf0e10cSrcweir public:
326cdf0e10cSrcweir     explicit            ImplFontEntry( const ImplFontSelectData& );
327cdf0e10cSrcweir     virtual             ~ImplFontEntry();
328cdf0e10cSrcweir 
329cdf0e10cSrcweir public: // TODO: make data members private
330cdf0e10cSrcweir     ImplFontSelectData  maFontSelData;      // FontSelectionData
331cdf0e10cSrcweir     ImplFontMetricData  maMetric;           // Font Metric
332cdf0e10cSrcweir     const ConvertChar*  mpConversion;       // used e.g. for StarBats->StarSymbol
333cdf0e10cSrcweir     long                mnLineHeight;
334cdf0e10cSrcweir     sal_uLong               mnRefCount;
335cdf0e10cSrcweir     sal_uInt16              mnSetFontFlags;     // Flags returned by SalGraphics::SetFont()
336cdf0e10cSrcweir     short               mnOwnOrientation;   // text angle if lower layers don't rotate text themselves
337cdf0e10cSrcweir     short               mnOrientation;      // text angle in 3600 system
338cdf0e10cSrcweir     bool                mbInit;             // true if maMetric member is valid
339cdf0e10cSrcweir 
340cdf0e10cSrcweir     void                AddFallbackForUnicode( sal_UCS4, FontWeight eWeight, const String& rFontName );
341cdf0e10cSrcweir     bool                GetFallbackForUnicode( sal_UCS4, FontWeight eWeight, String* pFontName ) const;
342cdf0e10cSrcweir     void                IgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, const String& rFontName );
343cdf0e10cSrcweir 
344cdf0e10cSrcweir private:
345cdf0e10cSrcweir     // cache of Unicode characters and replacement font names
346cdf0e10cSrcweir     // TODO: a fallback map can be shared with many other ImplFontEntries
347cdf0e10cSrcweir     // TODO: at least the ones which just differ in orientation, stretching or height
348cdf0e10cSrcweir     typedef ::std::pair<sal_UCS4,FontWeight> GFBCacheKey;
349cdf0e10cSrcweir     struct GFBCacheKey_Hash{ size_t operator()( const GFBCacheKey& ) const; };
350cdf0e10cSrcweir     typedef ::std::hash_map<GFBCacheKey,String,GFBCacheKey_Hash> UnicodeFallbackList;
351cdf0e10cSrcweir     UnicodeFallbackList* mpUnicodeFallbackList;
352cdf0e10cSrcweir };
353cdf0e10cSrcweir 
354cdf0e10cSrcweir 
355cdf0e10cSrcweir class ImplTextLineInfo
356cdf0e10cSrcweir {
357cdf0e10cSrcweir private:
358cdf0e10cSrcweir     long        mnWidth;
359cdf0e10cSrcweir     xub_StrLen  mnIndex;
360cdf0e10cSrcweir     xub_StrLen  mnLen;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir public:
ImplTextLineInfo(long nWidth,xub_StrLen nIndex,xub_StrLen nLen)363cdf0e10cSrcweir                 ImplTextLineInfo( long nWidth, xub_StrLen nIndex, xub_StrLen nLen )
364cdf0e10cSrcweir                 {
365cdf0e10cSrcweir                     mnWidth = nWidth;
366cdf0e10cSrcweir                     mnIndex = nIndex;
367cdf0e10cSrcweir                     mnLen   = nLen;
368cdf0e10cSrcweir                 }
369cdf0e10cSrcweir 
GetWidth() const370cdf0e10cSrcweir     long        GetWidth() const { return mnWidth; }
GetIndex() const371cdf0e10cSrcweir     xub_StrLen  GetIndex() const { return mnIndex; }
GetLen() const372cdf0e10cSrcweir     xub_StrLen  GetLen() const { return mnLen; }
373cdf0e10cSrcweir };
374cdf0e10cSrcweir 
375cdf0e10cSrcweir #define MULTITEXTLINEINFO_RESIZE    16
376cdf0e10cSrcweir typedef ImplTextLineInfo* PImplTextLineInfo;
377cdf0e10cSrcweir 
378cdf0e10cSrcweir class ImplMultiTextLineInfo
379cdf0e10cSrcweir {
380cdf0e10cSrcweir private:
381cdf0e10cSrcweir     PImplTextLineInfo*  mpLines;
382cdf0e10cSrcweir     xub_StrLen          mnLines;
383cdf0e10cSrcweir     xub_StrLen          mnSize;
384cdf0e10cSrcweir 
385cdf0e10cSrcweir public:
386cdf0e10cSrcweir                         ImplMultiTextLineInfo();
387cdf0e10cSrcweir                         ~ImplMultiTextLineInfo();
388cdf0e10cSrcweir 
389cdf0e10cSrcweir     void                AddLine( ImplTextLineInfo* pLine );
390cdf0e10cSrcweir     void                Clear();
391cdf0e10cSrcweir 
GetLine(sal_uInt16 nLine) const392cdf0e10cSrcweir     ImplTextLineInfo*   GetLine( sal_uInt16 nLine ) const
393cdf0e10cSrcweir                             { return mpLines[nLine]; }
Count() const394cdf0e10cSrcweir     xub_StrLen          Count() const { return mnLines; }
395cdf0e10cSrcweir 
396cdf0e10cSrcweir private:
397cdf0e10cSrcweir                             ImplMultiTextLineInfo( const ImplMultiTextLineInfo& );
398cdf0e10cSrcweir     ImplMultiTextLineInfo&  operator=( const ImplMultiTextLineInfo& );
399cdf0e10cSrcweir };
400cdf0e10cSrcweir 
401cdf0e10cSrcweir #endif // _SV_OUTFONT_HXX
402cdf0e10cSrcweir 
403