2 * Copyright 2001-2008, Haiku.
3 * Distributed under the terms of the MIT License.
6 * DarkWyrm <bpmagic@columbus.rr.com>
7 * Jérôme Duval, jerome.duval@free.fr
8 * Axel Dörfler, axeld@pinc-software.de
9 * Stephan Aßmus <superstippi@gmx.de>
18 #include "FontFamily.h"
19 #include "GlobalSubpixelSettings.h"
20 #include "Transformable.h"
29 ServerFont(FontStyle
& style
,
33 float falseBoldWidth
= 0.0,
35 uint8 spacing
= B_BITMAP_SPACING
);
36 ServerFont(const ServerFont
& font
);
37 virtual ~ServerFont();
39 ServerFont
&operator=(const ServerFont
& font
);
40 bool operator==(const ServerFont
& other
) const;
42 font_direction
Direction() const
43 { return fDirection
; }
44 uint32
Encoding() const
48 uint32
Spacing() const
52 float Rotation() const
54 float FalseBoldWidth() const
55 { return fFalseBoldWidth
; }
61 { return fStyle
->GlyphCount(); }
64 font_file_format
FileFormat();
66 const char* Style() const;
67 const char* Family() const;
68 const char* Path() const
69 { return fStyle
->Path(); }
71 void SetStyle(FontStyle
* style
);
72 status_t
SetFamilyAndStyle(uint16 familyID
,
74 status_t
SetFamilyAndStyle(uint32 fontID
);
76 uint16
StyleID() const
77 { return fStyle
->ID(); }
78 uint16
FamilyID() const
79 { return fStyle
->Family()->ID(); }
80 uint32
GetFamilyAndStyle() const;
82 void SetDirection(font_direction dir
)
84 void SetEncoding(uint32 encoding
)
85 { fEncoding
= encoding
; }
86 void SetFlags(uint32 value
)
88 void SetSpacing(uint32 value
)
90 void SetShear(float value
)
92 void SetSize(float value
)
94 void SetRotation(float value
)
95 { fRotation
= value
; }
96 void SetFalseBoldWidth(float value
)
97 { fFalseBoldWidth
= value
; }
98 status_t
SetFace(uint16 face
);
100 bool IsFixedWidth() const
101 { return fStyle
->IsFixedWidth(); }
102 bool IsScalable() const
103 { return fStyle
->IsScalable(); }
104 bool HasKerning() const
105 { return fStyle
->HasKerning(); }
106 bool HasTuned() const
107 { return fStyle
->HasTuned(); }
108 int32
TunedCount() const
109 { return fStyle
->TunedCount(); }
110 uint16
GlyphCount() const
111 { return fStyle
->GlyphCount(); }
112 uint16
CharMapCount() const
113 { return fStyle
->CharMapCount(); }
114 inline bool Hinting() const;
116 status_t
GetGlyphShapes(const char charArray
[],
117 int32 numChars
, BShape
*shapeArray
[]) const;
119 status_t
GetHasGlyphs(const char charArray
[],
120 int32 numBytes
, bool hasArray
[]) const;
122 status_t
GetEdges(const char charArray
[], int32 numBytes
,
123 edge_info edgeArray
[]) const;
125 status_t
GetEscapements(const char charArray
[],
126 int32 numBytes
, int32 numChars
,
127 escapement_delta delta
,
128 BPoint escapementArray
[],
129 BPoint offsetArray
[]) const;
131 status_t
GetEscapements(const char charArray
[],
132 int32 numBytes
, int32 numChars
,
133 escapement_delta delta
,
134 float widthArray
[]) const;
136 status_t
GetBoundingBoxes(const char charArray
[],
137 int32 numBytes
, BRect rectArray
[],
138 bool stringEscapement
,
139 font_metric_mode mode
,
140 escapement_delta delta
,
143 status_t
GetBoundingBoxesForStrings(char *charArray
[],
144 int32 lengthArray
[], int32 numStrings
,
145 BRect rectArray
[], font_metric_mode mode
,
146 escapement_delta deltaArray
[]);
148 float StringWidth(const char *string
,
150 const escapement_delta
* delta
= NULL
) const;
152 bool Lock() const { return fStyle
->Lock(); }
153 void Unlock() const { fStyle
->Unlock(); }
155 // FT_Face GetFTFace() const
156 // { return fStyle->FreeTypeFace(); };
159 void GetHeight(font_height
& height
) const;
161 void TruncateString(BString
* inOut
,
165 Transformable
EmbeddedTransformation() const;
166 status_t
GetUnicodeBlocks(unicode_block
&blocksForFont
);
167 status_t
IncludesUnicodeBlock(uint32 start
, uint32 end
, bool &hasBlock
);
170 friend class FontStyle
;
171 FT_Face
GetTransformedFace(bool rotate
,
173 void PutTransformedFace(FT_Face face
) const;
179 float fFalseBoldWidth
;
183 font_direction fDirection
;
188 inline bool ServerFont::Hinting() const
190 switch (gDefaultHintingMode
) {
191 case HINTING_MODE_OFF
:
194 case HINTING_MODE_ON
:
196 case HINTING_MODE_MONOSPACED_ONLY
:
197 return IsFixedWidth();
201 #endif /* SERVER_FONT_H */