22#ifndef ULTIMA8_GFX_FONTS_FONT_H
23#define ULTIMA8_GFX_FONTS_FONT_H
25#include "common/list.h"
26#include "common/rect.h"
27#include "common/str.h"
28#include "ultima/ultima8/misc/encoding.h"
38 Common::String::size_type _cursor;
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 Common::String::size_type cursor = Common::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(Common::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(Common::String::const_iterator &i,
bool u8specials) {
117 (u8specials && (c ==
'\t' || c ==
'%')));
119 static bool isBreak(Common::String::const_iterator &i,
bool u8specials) {
122 (u8specials && (c ==
'\n' || c ==
'~' || c ==
'*')));
124 static bool isPageBreak(Common::String::const_iterator &i,
bool u8specials) {
126 return (u8specials && c ==
'*');
128 static bool canBreakAfter(Common::String::const_iterator &i);
129 static void advance(Common::String::const_iterator &i) {
132 static Common::String::size_type length(
const Common::String &t) {
135 static uint32 unicode(Common::String::const_iterator &i) {
136 return encoding[
static_cast<uint8
>(*i++)];
140 static bool canBreakAfter(Common::String::const_iterator &i);
141 static void advance(Common::String::const_iterator &i) {
147 static Common::String::size_type length(
const Common::String &t) {
148 Common::String::size_type l = 0;
149 Common::String::const_iterator iter = t.begin();
150 while (iter != t.end()) {
156 static uint32 unicode(Common::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 Common::String::size_type cursor = Common::String::npos);
virtual int getHeight()=0
get the height of the font
virtual int getBaseline()=0
get the baseline of the font (relative from the top)
virtual int getBaselineSkip()=0
get the baselineskip of the font (distance between two baselines)
virtual void getStringSize(const Common::String &text, int32 &width, int32 &height)=0
virtual void getTextSize(const Common::String &text, int32 &resultwidth, int32 &resultheight, unsigned int &remaining, int32 width=0, int32 height=0, TextAlign align=TEXT_LEFT, bool u8specials=false, bool pagebreaks=false)
virtual RenderedText * renderText(const Common::String &text, unsigned int &remaining, int32 width=0, int32 height=0, TextAlign align=TEXT_LEFT, bool u8specials=false, bool pagebreaks=false, Common::String::size_type cursor=Common::String::npos)=0
Definition: rendered_text.h:32