MCPcopy Create free account
hub / github.com/axmolengine/axmol / setFont

Method setFont

core/platform/winrt/Device-winrt.cpp:98–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96 ~TextRenderer() {}
97
98 bool setFont(const FontDefinition& textDefinition)
99 {
100 bool bRet = false;
101 do
102 {
103 std::wstring wfontName = ntcvt::from_chars(textDefinition._fontName);
104
105 // italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL;
106 const DWRITE_FONT_STYLE fontStyle = DWRITE_FONT_STYLE_NORMAL;
107 // bold ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL;
108 const DWRITE_FONT_WEIGHT fontWeight = DWRITE_FONT_WEIGHT_NORMAL;
109
110 ASSERT_HR(_dwriteFactory->CreateTextFormat(wfontName.c_str(), nullptr, fontWeight, fontStyle,
111 DWRITE_FONT_STRETCH_NORMAL, textDefinition._fontSize, L"",
112 _textFormat.put()));
113
114 if (textDefinition._alignment == TextHAlignment::CENTER)
115 _textFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);
116
117 if (textDefinition._vertAlignment == TextVAlignment::CENTER)
118 _textFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
119
120 return static_cast<bool>(_textFormat);
121
122 bRet = true;
123 } while (0);
124 return bRet;
125 }
126
127 SIZE sizeWithText(const wchar_t* text,
128 int nLen,

Callers 1

getTextureDataForTextMethod · 0.45

Calls 3

from_charsFunction · 0.85
c_strMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected