diff options
Diffstat (limited to 'linden/indra/llrender/llfontgl.cpp')
-rw-r--r-- | linden/indra/llrender/llfontgl.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/linden/indra/llrender/llfontgl.cpp b/linden/indra/llrender/llfontgl.cpp index 253bf50..a328196 100644 --- a/linden/indra/llrender/llfontgl.cpp +++ b/linden/indra/llrender/llfontgl.cpp | |||
@@ -48,7 +48,7 @@ F32 LLFontGL::sHorizDPI = 96.f; | |||
48 | F32 LLFontGL::sScaleX = 1.f; | 48 | F32 LLFontGL::sScaleX = 1.f; |
49 | F32 LLFontGL::sScaleY = 1.f; | 49 | F32 LLFontGL::sScaleY = 1.f; |
50 | BOOL LLFontGL::sDisplayFont = TRUE ; | 50 | BOOL LLFontGL::sDisplayFont = TRUE ; |
51 | LLString LLFontGL::sAppDir; | 51 | std::string LLFontGL::sAppDir; |
52 | 52 | ||
53 | LLFontGL* LLFontGL::sMonospace = NULL; | 53 | LLFontGL* LLFontGL::sMonospace = NULL; |
54 | LLFontGL* LLFontGL::sSansSerifSmall = NULL; | 54 | LLFontGL* LLFontGL::sSansSerifSmall = NULL; |
@@ -93,7 +93,7 @@ F32 llfont_round_y(F32 y) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | // static | 95 | // static |
96 | U8 LLFontGL::getStyleFromString(const LLString &style) | 96 | U8 LLFontGL::getStyleFromString(const std::string &style) |
97 | { | 97 | { |
98 | S32 ret = 0; | 98 | S32 ret = 0; |
99 | if (style.find("NORMAL") != style.npos) | 99 | if (style.find("NORMAL") != style.npos) |
@@ -166,9 +166,9 @@ void LLFontGL::reset() | |||
166 | } | 166 | } |
167 | 167 | ||
168 | // static | 168 | // static |
169 | LLString LLFontGL::getFontPathSystem() | 169 | std::string LLFontGL::getFontPathSystem() |
170 | { | 170 | { |
171 | LLString system_path; | 171 | std::string system_path; |
172 | 172 | ||
173 | // Try to figure out where the system's font files are stored. | 173 | // Try to figure out where the system's font files are stored. |
174 | char *system_root = NULL; | 174 | char *system_root = NULL; |
@@ -199,9 +199,9 @@ LLString LLFontGL::getFontPathSystem() | |||
199 | 199 | ||
200 | 200 | ||
201 | // static | 201 | // static |
202 | LLString LLFontGL::getFontPathLocal() | 202 | std::string LLFontGL::getFontPathLocal() |
203 | { | 203 | { |
204 | LLString local_path; | 204 | std::string local_path; |
205 | 205 | ||
206 | // Backup files if we can't load from system fonts directory. | 206 | // Backup files if we can't load from system fonts directory. |
207 | // We could store this in an end-user writable directory to allow | 207 | // We could store this in an end-user writable directory to allow |
@@ -220,10 +220,10 @@ LLString LLFontGL::getFontPathLocal() | |||
220 | } | 220 | } |
221 | 221 | ||
222 | //static | 222 | //static |
223 | bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, const F32 point_size) | 223 | bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const std::string& fontname, const F32 point_size) |
224 | { | 224 | { |
225 | LLString local_path = getFontPathLocal(); | 225 | std::string local_path = getFontPathLocal(); |
226 | LLString sys_path = getFontPathSystem(); | 226 | std::string sys_path = getFontPathSystem(); |
227 | 227 | ||
228 | // The fontname string may contain multiple font file names separated by semicolons. | 228 | // The fontname string may contain multiple font file names separated by semicolons. |
229 | // Break it apart and try loading each one, in order. | 229 | // Break it apart and try loading each one, in order. |
@@ -235,7 +235,7 @@ bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, | |||
235 | for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) | 235 | for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) |
236 | { | 236 | { |
237 | LLFont *fontp = new LLFont(); | 237 | LLFont *fontp = new LLFont(); |
238 | LLString font_path = local_path + *token_iter; | 238 | std::string font_path = local_path + *token_iter; |
239 | if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE)) | 239 | if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE)) |
240 | { | 240 | { |
241 | font_path = sys_path + *token_iter; | 241 | font_path = sys_path + *token_iter; |
@@ -258,13 +258,13 @@ bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const LLString& fontname, | |||
258 | } | 258 | } |
259 | 259 | ||
260 | //static | 260 | //static |
261 | bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 point_size, LLFontList *fallback_fontp) | 261 | bool LLFontGL::loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp) |
262 | { | 262 | { |
263 | LLString local_path = getFontPathLocal(); | 263 | std::string local_path = getFontPathLocal(); |
264 | LLString font_path = local_path + fontname; | 264 | std::string font_path = local_path + fontname; |
265 | if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) | 265 | if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) |
266 | { | 266 | { |
267 | LLString sys_path = getFontPathSystem(); | 267 | std::string sys_path = getFontPathSystem(); |
268 | font_path = sys_path + fontname; | 268 | font_path = sys_path + fontname; |
269 | if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) | 269 | if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE)) |
270 | { | 270 | { |
@@ -280,12 +280,12 @@ bool LLFontGL::loadFace(LLFontGL *fontp, const LLString& fontname, const F32 poi | |||
280 | 280 | ||
281 | // static | 281 | // static |
282 | BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, | 282 | BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale, |
283 | const LLString& monospace_file, F32 monospace_size, | 283 | const std::string& monospace_file, F32 monospace_size, |
284 | const LLString& sansserif_file, | 284 | const std::string& sansserif_file, |
285 | const LLString& sanserif_fallback_file, F32 ss_fallback_scale, | 285 | const std::string& sanserif_fallback_file, F32 ss_fallback_scale, |
286 | F32 small_size, F32 medium_size, F32 big_size, F32 huge_size, | 286 | F32 small_size, F32 medium_size, F32 big_size, F32 huge_size, |
287 | const LLString& sansserif_bold_file, F32 bold_size, | 287 | const std::string& sansserif_bold_file, F32 bold_size, |
288 | const LLString& app_dir) | 288 | const std::string& app_dir) |
289 | { | 289 | { |
290 | BOOL failed = FALSE; | 290 | BOOL failed = FALSE; |
291 | sVertDPI = (F32)llfloor(screen_dpi * y_scale); | 291 | sVertDPI = (F32)llfloor(screen_dpi * y_scale); |
@@ -554,7 +554,7 @@ BOOL LLFontGL::addChar(const llwchar wch) | |||
554 | } | 554 | } |
555 | 555 | ||
556 | 556 | ||
557 | S32 LLFontGL::renderUTF8(const LLString &text, const S32 offset, | 557 | S32 LLFontGL::renderUTF8(const std::string &text, const S32 offset, |
558 | const F32 x, const F32 y, | 558 | const F32 x, const F32 y, |
559 | const LLColor4 &color, | 559 | const LLColor4 &color, |
560 | const HAlign halign, const VAlign valign, | 560 | const HAlign halign, const VAlign valign, |
@@ -726,7 +726,7 @@ S32 LLFontGL::render(const LLWString &wstr, | |||
726 | if (getWidthF32(wstr.c_str(), 0, max_chars) * sScaleX > scaled_max_pixels) | 726 | if (getWidthF32(wstr.c_str(), 0, max_chars) * sScaleX > scaled_max_pixels) |
727 | { | 727 | { |
728 | // use four dots for ellipsis width to generate padding | 728 | // use four dots for ellipsis width to generate padding |
729 | const LLWString dots(utf8str_to_wstring(LLString("...."))); | 729 | const LLWString dots(utf8str_to_wstring(std::string("...."))); |
730 | scaled_max_pixels = llmax(0, scaled_max_pixels - llround(getWidthF32(dots.c_str()))); | 730 | scaled_max_pixels = llmax(0, scaled_max_pixels - llround(getWidthF32(dots.c_str()))); |
731 | draw_ellipses = TRUE; | 731 | draw_ellipses = TRUE; |
732 | } | 732 | } |
@@ -879,7 +879,7 @@ S32 LLFontGL::render(const LLWString &wstr, | |||
879 | //glLoadIdentity(); | 879 | //glLoadIdentity(); |
880 | //gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f); | 880 | //gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f); |
881 | //glScalef(sScaleX, sScaleY, 1.f); | 881 | //glScalef(sScaleX, sScaleY, 1.f); |
882 | renderUTF8("...", | 882 | renderUTF8(std::string("..."), |
883 | 0, | 883 | 0, |
884 | cur_x / sScaleX, (F32)y, | 884 | cur_x / sScaleX, (F32)y, |
885 | color, | 885 | color, |
@@ -902,7 +902,7 @@ LLImageGL *LLFontGL::getImageGL() const | |||
902 | return mImageGLp; | 902 | return mImageGLp; |
903 | } | 903 | } |
904 | 904 | ||
905 | S32 LLFontGL::getWidth(const LLString& utf8text) const | 905 | S32 LLFontGL::getWidth(const std::string& utf8text) const |
906 | { | 906 | { |
907 | LLWString wtext = utf8str_to_wstring(utf8text); | 907 | LLWString wtext = utf8str_to_wstring(utf8text); |
908 | return getWidth(wtext.c_str(), 0, S32_MAX); | 908 | return getWidth(wtext.c_str(), 0, S32_MAX); |
@@ -913,7 +913,7 @@ S32 LLFontGL::getWidth(const llwchar* wchars) const | |||
913 | return getWidth(wchars, 0, S32_MAX); | 913 | return getWidth(wchars, 0, S32_MAX); |
914 | } | 914 | } |
915 | 915 | ||
916 | S32 LLFontGL::getWidth(const LLString& utf8text, const S32 begin_offset, const S32 max_chars) const | 916 | S32 LLFontGL::getWidth(const std::string& utf8text, const S32 begin_offset, const S32 max_chars) const |
917 | { | 917 | { |
918 | LLWString wtext = utf8str_to_wstring(utf8text); | 918 | LLWString wtext = utf8str_to_wstring(utf8text); |
919 | return getWidth(wtext.c_str(), begin_offset, max_chars); | 919 | return getWidth(wtext.c_str(), begin_offset, max_chars); |
@@ -925,7 +925,7 @@ S32 LLFontGL::getWidth(const llwchar* wchars, const S32 begin_offset, const S32 | |||
925 | return llround(width); | 925 | return llround(width); |
926 | } | 926 | } |
927 | 927 | ||
928 | F32 LLFontGL::getWidthF32(const LLString& utf8text) const | 928 | F32 LLFontGL::getWidthF32(const std::string& utf8text) const |
929 | { | 929 | { |
930 | LLWString wtext = utf8str_to_wstring(utf8text); | 930 | LLWString wtext = utf8str_to_wstring(utf8text); |
931 | return getWidthF32(wtext.c_str(), 0, S32_MAX); | 931 | return getWidthF32(wtext.c_str(), 0, S32_MAX); |
@@ -936,7 +936,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars) const | |||
936 | return getWidthF32(wchars, 0, S32_MAX); | 936 | return getWidthF32(wchars, 0, S32_MAX); |
937 | } | 937 | } |
938 | 938 | ||
939 | F32 LLFontGL::getWidthF32(const LLString& utf8text, const S32 begin_offset, const S32 max_chars ) const | 939 | F32 LLFontGL::getWidthF32(const std::string& utf8text, const S32 begin_offset, const S32 max_chars ) const |
940 | { | 940 | { |
941 | LLWString wtext = utf8str_to_wstring(utf8text); | 941 | LLWString wtext = utf8str_to_wstring(utf8text); |
942 | return getWidthF32(wtext.c_str(), begin_offset, max_chars); | 942 | return getWidthF32(wtext.c_str(), begin_offset, max_chars); |
@@ -1312,7 +1312,7 @@ void LLFontGL::clearEmbeddedChars() | |||
1312 | mEmbeddedChars.clear(); | 1312 | mEmbeddedChars.clear(); |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLString& label ) | 1315 | void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label ) |
1316 | { | 1316 | { |
1317 | LLWString wlabel = utf8str_to_wstring(label); | 1317 | LLWString wlabel = utf8str_to_wstring(label); |
1318 | addEmbeddedChar(wc, image, wlabel); | 1318 | addEmbeddedChar(wc, image, wlabel); |
@@ -1429,40 +1429,40 @@ void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, con | |||
1429 | } | 1429 | } |
1430 | 1430 | ||
1431 | // static | 1431 | // static |
1432 | LLString LLFontGL::nameFromFont(const LLFontGL* fontp) | 1432 | std::string LLFontGL::nameFromFont(const LLFontGL* fontp) |
1433 | { | 1433 | { |
1434 | if (fontp == sSansSerifHuge) | 1434 | if (fontp == sSansSerifHuge) |
1435 | { | 1435 | { |
1436 | return LLString("SansSerifHuge"); | 1436 | return std::string("SansSerifHuge"); |
1437 | } | 1437 | } |
1438 | else if (fontp == sSansSerifSmall) | 1438 | else if (fontp == sSansSerifSmall) |
1439 | { | 1439 | { |
1440 | return LLString("SansSerifSmall"); | 1440 | return std::string("SansSerifSmall"); |
1441 | } | 1441 | } |
1442 | else if (fontp == sSansSerif) | 1442 | else if (fontp == sSansSerif) |
1443 | { | 1443 | { |
1444 | return LLString("SansSerif"); | 1444 | return std::string("SansSerif"); |
1445 | } | 1445 | } |
1446 | else if (fontp == sSansSerifBig) | 1446 | else if (fontp == sSansSerifBig) |
1447 | { | 1447 | { |
1448 | return LLString("SansSerifBig"); | 1448 | return std::string("SansSerifBig"); |
1449 | } | 1449 | } |
1450 | else if (fontp == sSansSerifBold) | 1450 | else if (fontp == sSansSerifBold) |
1451 | { | 1451 | { |
1452 | return LLString("SansSerifBold"); | 1452 | return std::string("SansSerifBold"); |
1453 | } | 1453 | } |
1454 | else if (fontp == sMonospace) | 1454 | else if (fontp == sMonospace) |
1455 | { | 1455 | { |
1456 | return LLString("Monospace"); | 1456 | return std::string("Monospace"); |
1457 | } | 1457 | } |
1458 | else | 1458 | else |
1459 | { | 1459 | { |
1460 | return LLString(); | 1460 | return std::string(); |
1461 | } | 1461 | } |
1462 | } | 1462 | } |
1463 | 1463 | ||
1464 | // static | 1464 | // static |
1465 | LLFontGL* LLFontGL::fontFromName(const LLString& font_name) | 1465 | LLFontGL* LLFontGL::fontFromName(const std::string& font_name) |
1466 | { | 1466 | { |
1467 | LLFontGL* gl_font = NULL; | 1467 | LLFontGL* gl_font = NULL; |
1468 | if (font_name == "SansSerifHuge") | 1468 | if (font_name == "SansSerifHuge") |
@@ -1493,16 +1493,16 @@ LLFontGL* LLFontGL::fontFromName(const LLString& font_name) | |||
1493 | } | 1493 | } |
1494 | 1494 | ||
1495 | // static | 1495 | // static |
1496 | LLString LLFontGL::nameFromHAlign(LLFontGL::HAlign align) | 1496 | std::string LLFontGL::nameFromHAlign(LLFontGL::HAlign align) |
1497 | { | 1497 | { |
1498 | if (align == LEFT) return LLString("left"); | 1498 | if (align == LEFT) return std::string("left"); |
1499 | else if (align == RIGHT) return LLString("right"); | 1499 | else if (align == RIGHT) return std::string("right"); |
1500 | else if (align == HCENTER) return LLString("center"); | 1500 | else if (align == HCENTER) return std::string("center"); |
1501 | else return LLString(); | 1501 | else return std::string(); |
1502 | } | 1502 | } |
1503 | 1503 | ||
1504 | // static | 1504 | // static |
1505 | LLFontGL::HAlign LLFontGL::hAlignFromName(const LLString& name) | 1505 | LLFontGL::HAlign LLFontGL::hAlignFromName(const std::string& name) |
1506 | { | 1506 | { |
1507 | LLFontGL::HAlign gl_hfont_align = LLFontGL::LEFT; | 1507 | LLFontGL::HAlign gl_hfont_align = LLFontGL::LEFT; |
1508 | if (name == "left") | 1508 | if (name == "left") |
@@ -1522,17 +1522,17 @@ LLFontGL::HAlign LLFontGL::hAlignFromName(const LLString& name) | |||
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | // static | 1524 | // static |
1525 | LLString LLFontGL::nameFromVAlign(LLFontGL::VAlign align) | 1525 | std::string LLFontGL::nameFromVAlign(LLFontGL::VAlign align) |
1526 | { | 1526 | { |
1527 | if (align == TOP) return LLString("top"); | 1527 | if (align == TOP) return std::string("top"); |
1528 | else if (align == VCENTER) return LLString("center"); | 1528 | else if (align == VCENTER) return std::string("center"); |
1529 | else if (align == BASELINE) return LLString("baseline"); | 1529 | else if (align == BASELINE) return std::string("baseline"); |
1530 | else if (align == BOTTOM) return LLString("bottom"); | 1530 | else if (align == BOTTOM) return std::string("bottom"); |
1531 | else return LLString(); | 1531 | else return std::string(); |
1532 | } | 1532 | } |
1533 | 1533 | ||
1534 | // static | 1534 | // static |
1535 | LLFontGL::VAlign LLFontGL::vAlignFromName(const LLString& name) | 1535 | LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name) |
1536 | { | 1536 | { |
1537 | LLFontGL::VAlign gl_vfont_align = LLFontGL::BASELINE; | 1537 | LLFontGL::VAlign gl_vfont_align = LLFontGL::BASELINE; |
1538 | if (name == "top") | 1538 | if (name == "top") |