22 #ifndef ULTIMA8_GFX_FONTS_FONT_H 23 #define ULTIMA8_GFX_FONTS_FONT_H 25 #include "ultima/shared/std/containers.h" 26 #include "ultima/shared/std/string.h" 27 #include "ultima/ultima8/misc/rect.h" 28 #include "ultima/ultima8/misc/encoding.h" 38 Std::string::size_type _cursor;
53 virtual int getHeight() = 0;
56 virtual int getBaseline() = 0;
59 virtual int getBaselineSkip() = 0;
66 int32 &width, int32 &height) = 0;
78 unsigned int &remaining, int32 width = 0, int32 height = 0,
79 TextAlign align = TEXT_LEFT,
bool u8specials =
false,
80 bool pagebreaks =
false,
81 Std::string::size_type cursor = Std::string::npos) = 0;
94 int32 &resultwidth, int32 &resultheight,
unsigned int &remaining,
95 int32 width = 0, int32 height = 0, TextAlign align = TEXT_LEFT,
96 bool u8specials =
false,
bool pagebreaks =
false);
98 void setHighRes(
bool hr) {
101 bool isHighRes()
const {
109 static bool isSpace(Std::string::const_iterator &i,
bool u8specials) {
111 return (c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r' ||
112 (u8specials && (c ==
'%' || c ==
'~' || c ==
'*' || c ==
'^')));
114 static bool isTab(Std::string::const_iterator &i,
bool u8specials) {
117 (u8specials && (c ==
'\t' || c ==
'%')));
119 static bool isBreak(Std::string::const_iterator &i,
bool u8specials) {
122 (u8specials && (c ==
'\n' || c ==
'~' || c ==
'*')));
124 static bool isPageBreak(Std::string::const_iterator &i,
bool u8specials) {
126 return (u8specials && c ==
'*');
128 static bool canBreakAfter(Std::string::const_iterator &i);
129 static void advance(Std::string::const_iterator &i) {
132 static Std::string::size_type length(
const Std::string &t) {
135 static uint32 unicode(Std::string::const_iterator &i) {
136 return encoding[
static_cast<uint8
>(*i++)];
140 static bool canBreakAfter(Std::string::const_iterator &i);
141 static void advance(Std::string::const_iterator &i) {
147 static Std::string::size_type length(
const Std::string &t) {
148 Std::string::size_type l = 0;
149 Std::string::const_iterator iter = t.begin();
150 while (iter != t.end()) {
156 static uint32 unicode(Std::string::const_iterator &i) {
157 uint16 s =
static_cast<uint8
>(*i);
160 uint16 t =
static_cast<uint8
>(*i++);
163 return shiftjis_to_unicode(s);
171 int32 width, int32 height, Font::TextAlign align,
172 bool u8specials,
bool pagebreaks,
173 int32 &resultwidth, int32 &resultheight,
174 Std::string::size_type cursor = Std::string::npos);
Definition: rendered_text.h:30
Definition: detection.h:27
Definition: containers.h:200