28 #ifndef YSL_INC_SERVICE_TEXTRENDERER_H_
29 #define YSL_INC_SERVICE_TEXTRENDERER_H_ 1
32 #include "../Core/ystring.h"
46 template<typename _tIn, class _tRenderer>
50 while(*s != 0 && *s !=
'\n')
67 template<
typename _tIn,
class _tRenderer>
71 while(s != g &&
ucs4_t(*s) != c && *s !=
'\n')
85 template<
class _tRenderer>
86 inline String::size_type
89 return PrintLine(r, str.c_str()) - str.c_str();
101 template<
typename _tIn,
class _tRenderer>
106 const SPos fpy(ts.Pen.Y);
108 while(*s != 0 && fpy == ts.Pen.Y)
124 template<
typename _tIn,
class _tRenderer>
128 TextState& ts(r.GetTextState());
129 const SPos fpy(ts.Pen.Y);
131 while(s != g &&
ucs4_t(*s) != c && fpy == ts.Pen.Y)
144 template<
class _tRenderer>
145 inline String::size_type
148 return PutLine(r, str.c_str()) - str.c_str();
159 template<
typename _tIn,
class _tRenderer>
163 while(*s != 0 && *s !=
'\n')
177 template<
typename _tIn,
class _tRenderer>
181 while(s != g &&
ucs4_t(*s) != c && *s !=
'\n')
192 template<
class _tRenderer>
193 inline String::size_type
208 template<
typename _tIn,
class _tRenderer>
215 while(*s != 0 && ts.Pen.Y <= mpy)
231 template<
typename _tIn,
class _tRenderer>
235 TextState& ts(r.GetTextState());
238 while(s != g &&
ucs4_t(*s) != c && ts.Pen.Y <= mpy)
251 template<
class _tRenderer>
252 inline String::size_type
255 return PutString(r, str.c_str()) - str.c_str();
276 : State(ts), Height(h)
299 template<class _type>
303 DeclSEntry(
const TextState& GetTextState()
const)
307 #define This static_cast<_type*>(this)
308 #define CThis static_cast<const _type*>(this)
319 CThis->GetContext().GetHeight() +
CThis->GetTextState().LineGap))
344 State(ts), Buffer(g), ClipArea(g.GetSize())
352 State(ts), Buffer(g), ClipArea(mask)
361 ImplS(GTextRendererBase)
DefGetter(const ynothrow, const TextState&,
380 ClearLine(
u16 l, SDst n);
403 template<
typename... _tParams>
405 TextRegion(_tParams&&... args)
406 : GTextRendererBase<TextRegion>(),
407 TextState(
yforward(args)...), BitmapBufferEx()
426 operator=(const TextState& ts)
428 TextState::operator=(ts);
448 ImplS(GTextRendererBase)
DefGetter(const ynothrow, const TextState&,
451 ImplS(GTextRendererBase)
DefGetter(const ynothrow, const Graphics&, Context,
467 ClearLine(
u16 l, SDst n);
489 Scroll(ptrdiff_t n, SDst
h);
504 const String& str,
bool line_wrap);
518 const String& str, const
Padding& m,
Color,
bool line_wrap,
519 const
Font& fnt = {});
530 DrawText(
const Graphics& g, TextState& ts,
const String& str,
bool line_wrap);
542 DrawText(
const Graphics& g,
const Rect& bounds,
const String& str,
556 DrawText(TextRegion& r,
const Graphics& g,
const Point& pt,
const Size& s,
557 const String& str,
bool line_wrap);