mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Query of font size is supported
This commit is contained in:
parent
d77c894adc
commit
b40db11955
|
@ -1164,6 +1164,28 @@ namespace MiniEngine
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect Font::sizeText(const std::string& Text) throw (ErrorViewer)
|
||||||
|
{
|
||||||
|
int w=0,h=0;
|
||||||
|
if(TTF_SizeText(_get(),Text.c_str(),&w,&h)!=0)
|
||||||
|
{
|
||||||
|
/// Something might be wrong
|
||||||
|
throw ErrorViewer();
|
||||||
|
}
|
||||||
|
return Rect(0,0,w,h);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect Font::sizeUTF8(const std::string& Text) throw (ErrorViewer)
|
||||||
|
{
|
||||||
|
int w=0,h=0;
|
||||||
|
if(TTF_SizeUTF8(_get(),Text.c_str(),&w,&h)!=0)
|
||||||
|
{
|
||||||
|
/// Something might be wrong
|
||||||
|
throw ErrorViewer();
|
||||||
|
}
|
||||||
|
return Rect(0,0,w,h);
|
||||||
|
}
|
||||||
|
|
||||||
/// rendering surfaces...
|
/// rendering surfaces...
|
||||||
Surface Font::renderText(std::string Text,RGBA fg)
|
Surface Font::renderText(std::string Text,RGBA fg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -373,6 +373,9 @@ namespace MiniEngine
|
||||||
|
|
||||||
std::tuple<Style> getFontStyles();
|
std::tuple<Style> getFontStyles();
|
||||||
|
|
||||||
|
Rect sizeText(const std::string& Text) throw (ErrorViewer);
|
||||||
|
Rect sizeUTF8(const std::string& Text) throw (ErrorViewer);
|
||||||
|
|
||||||
Surface renderText(std::string Text, RGBA fg);
|
Surface renderText(std::string Text, RGBA fg);
|
||||||
Surface renderTextWrapped(std::string Text, RGBA fg, int WrapLength);
|
Surface renderTextWrapped(std::string Text, RGBA fg, int WrapLength);
|
||||||
Surface renderTextShaded(std::string Text, RGBA fg, RGBA bg);
|
Surface renderTextShaded(std::string Text, RGBA fg, RGBA bg);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user