diff options
-rw-r--r-- | doc/contributions.txt | 3 | ||||
-rw-r--r-- | indra/llrender/llfontgl.cpp | 55 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 29 | ||||
-rw-r--r-- | indra/newview/fonts/DejaVu-license.txt | 99 | ||||
-rw-r--r-- | indra/newview/fonts/DejaVuSansMono.ttf | bin | 0 -> 319388 bytes | |||
-rw-r--r-- | indra/newview/llappviewer.cpp | 23 |
6 files changed, 144 insertions, 65 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt index f4228e010f..1fcfb82738 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -205,6 +205,9 @@ Hiro Sommambulist VWR-143 Hoze Menges VWR-255 +Ian Kas + VWR-8780 (Russian localization) + [NO JIRA] (Ukranian localization) Iskar Ariantho VWR-1223 Jacek Antonelli diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 40704b957c..846f18f4a9 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -76,7 +76,7 @@ const F32 EXT_KERNING = 1.f; const F32 PIXEL_BORDER_THRESHOLD = 0.0001f; const F32 PIXEL_CORRECTION_DISTANCE = 0.01f; -const F32 PAD_AMT = 0.5f; +const F32 PAD_UVY = 0.5f; // half of vertical padding between glyphs in the glyph texture const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f; F32 llfont_round_x(F32 x) @@ -624,25 +624,12 @@ S32 LLFontGL::render(const LLWString &wstr, gGL.pushMatrix(); glLoadIdentity(); gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ); - //glScalef(sScaleX, sScaleY, 1.0f); - - // avoid half pixels - // RN: if we're going to this trouble, might as well snap to nearest pixel all the time - // but the plan is to get rid of this so that fonts "just work" - //F32 half_pixel_distance = llabs(fmodf(sCurOrigin.mX * sScaleX, 1.f) - 0.5f); - //if (half_pixel_distance < PIXEL_BORDER_THRESHOLD) - //{ - gGL.translatef(PIXEL_CORRECTION_DISTANCE*sScaleX, 0.f, 0.f); - //} - - // this code would just snap to pixel grid, although it seems to introduce more jitter - //F32 pixel_offset_x = llround(sCurOrigin.mX * sScaleX) - (sCurOrigin.mX * sScaleX); - //F32 pixel_offset_y = llround(sCurOrigin.mY * sScaleY) - (sCurOrigin.mY * sScaleY); - //gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f); - - // scale back to native pixel size - //glScalef(1.f / sScaleX, 1.f / sScaleY, 1.f); - //glScaled(1.0 / (F64) sScaleX, 1.0 / (F64) sScaleY, 1.0f); + + // this code snaps the text origin to a pixel grid to start with + F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX); + F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY); + gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f); + LLFastTimer t(LLFastTimer::FTM_RENDER_FONTS); gGL.color4fv( color.mV ); @@ -705,10 +692,6 @@ S32 LLFontGL::render(const LLWString &wstr, break; } - // Round properly. - //cur_render_y = (F32)llfloor(cur_y/sScaleY + 0.5f)*sScaleY; - //cur_render_x = (F32)llfloor(cur_x/sScaleX + 0.5f)*sScaleX; - cur_render_y = cur_y; cur_render_x = cur_x; @@ -763,8 +746,9 @@ S32 LLFontGL::render(const LLWString &wstr, } gGL.getTexUnit(0)->bind(ext_image); - const F32 ext_x = cur_render_x + (EXT_X_BEARING * sScaleX); - const F32 ext_y = cur_render_y + (EXT_Y_BEARING * sScaleY + mAscender - mLineHeight); + // snap origin to whole screen pixel + const F32 ext_x = (F32)llround(cur_render_x + (EXT_X_BEARING * sScaleX)); + const F32 ext_y = (F32)llround(cur_render_y + (EXT_Y_BEARING * sScaleY + mAscender - mLineHeight)); LLRectf uv_rect(0.f, 1.f, 1.f, 0.f); LLRectf screen_rect(ext_x, ext_y + ext_height, ext_x + ext_width, ext_y); @@ -819,15 +803,16 @@ S32 LLFontGL::render(const LLWString &wstr, // Draw the text at the appropriate location //Specify vertices and texture coordinates - LLRectf uv_rect((fgi->mXBitmapOffset - PAD_AMT) * inv_width, - (fgi->mYBitmapOffset + fgi->mHeight + PAD_AMT) * inv_height, - (fgi->mXBitmapOffset + fgi->mWidth + PAD_AMT) * inv_width, - (fgi->mYBitmapOffset - PAD_AMT) * inv_height); - LLRectf screen_rect(cur_render_x + (F32)fgi->mXBearing - PAD_AMT, - cur_render_y + (F32)fgi->mYBearing + PAD_AMT, - cur_render_x + (F32)fgi->mXBearing + (F32)fgi->mWidth + PAD_AMT, - cur_render_y + (F32)fgi->mYBearing - (F32)fgi->mHeight - PAD_AMT); - + LLRectf uv_rect((fgi->mXBitmapOffset) * inv_width, + (fgi->mYBitmapOffset + fgi->mHeight + PAD_UVY) * inv_height, + (fgi->mXBitmapOffset + fgi->mWidth) * inv_width, + (fgi->mYBitmapOffset - PAD_UVY) * inv_height); + // snap glyph origin to whole screen pixel + LLRectf screen_rect(llround(cur_render_x + (F32)fgi->mXBearing), + llround(cur_render_y + (F32)fgi->mYBearing), + llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, + llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); + drawGlyph(screen_rect, uv_rect, color, style, drop_shadow_strength); chars_drawn++; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3375d0e946..2cc8224fc6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3724,31 +3724,42 @@ <key>FontMonospace</key> <map> <key>Comment</key> - <string>Name of monospace font (Truetype file name)</string> + <string>Name of monospace font that definitely exists (Truetype file name)</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>String</string> <key>Value</key> - <string>profontwindows.ttf</string> + <string>DejaVuSansMono.ttf</string> </map> <key>FontSansSerif</key> <map> <key>Comment</key> - <string>Name of san-serif font (Truetype file name)</string> + <string>Name of primary sans-serif font that definitely exists (Truetype file name)</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>String</string> <key>Value</key> <string>MtBkLfRg.ttf</string> </map> + <key>FontSansSerifBundledFallback</key> + <map> + <key>Comment</key> + <string>Name of secondary sans-serif font that definitely exists (Truetype file name)</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string>DejaVuSansCondensed.ttf</string> + </map> <key>FontSansSerifBold</key> <map> <key>Comment</key> <string>Name of bold font (Truetype file name)</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>String</string> <key>Value</key> @@ -3757,9 +3768,9 @@ <key>FontSansSerifFallback</key> <map> <key>Comment</key> - <string>Name of san-serif font (Truetype file name)</string> + <string>Name of sans-serif font (Truetype file name)</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>String</string> <key>Value</key> @@ -3829,7 +3840,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>9.0</real> + <real>8.1</real> </map> <key>FontSizeSmall</key> <map> diff --git a/indra/newview/fonts/DejaVu-license.txt b/indra/newview/fonts/DejaVu-license.txt new file mode 100644 index 0000000000..254e2cc42a --- /dev/null +++ b/indra/newview/fonts/DejaVu-license.txt @@ -0,0 +1,99 @@ +Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. +Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below) + +Bitstream Vera Fonts Copyright +------------------------------ + +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is +a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of the fonts accompanying this license ("Fonts") and associated +documentation files (the "Font Software"), to reproduce and distribute the +Font Software, including without limitation the rights to use, copy, merge, +publish, distribute, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to the +following conditions: + +The above copyright and trademark notices and this permission notice shall +be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular +the designs of glyphs or characters in the Fonts may be modified and +additional glyphs or characters may be added to the Fonts, only if the fonts +are renamed to names not containing either the words "Bitstream" or the word +"Vera". + +This License becomes null and void to the extent applicable to Fonts or Font +Software that has been modified and is distributed under the "Bitstream +Vera" names. + +The Font Software may be sold as part of a larger software package but no +copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME +FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING +ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE +FONT SOFTWARE. + +Except as contained in this notice, the names of Gnome, the Gnome +Foundation, and Bitstream Inc., shall not be used in advertising or +otherwise to promote the sale, use or other dealings in this Font Software +without prior written authorization from the Gnome Foundation or Bitstream +Inc., respectively. For further information, contact: fonts at gnome dot +org. + +Arev Fonts Copyright +------------------------------ + +Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the fonts accompanying this license ("Fonts") and +associated documentation files (the "Font Software"), to reproduce +and distribute the modifications to the Bitstream Vera Font Software, +including without limitation the rights to use, copy, merge, publish, +distribute, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to +the following conditions: + +The above copyright and trademark notices and this permission notice +shall be included in all copies of one or more of the Font Software +typefaces. + +The Font Software may be modified, altered, or added to, and in +particular the designs of glyphs or characters in the Fonts may be +modified and additional glyphs or characters may be added to the +Fonts, only if the fonts are renamed to names not containing either +the words "Tavmjong Bah" or the word "Arev". + +This License becomes null and void to the extent applicable to Fonts +or Font Software that has been modified and is distributed under the +"Tavmjong Bah Arev" names. + +The Font Software may be sold as part of a larger software package but +no copy of one or more of the Font Software typefaces may be sold by +itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL +TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +Except as contained in this notice, the name of Tavmjong Bah shall not +be used in advertising or otherwise to promote the sale, use or other +dealings in this Font Software without prior written authorization +from Tavmjong Bah. For further information, contact: tavmjong @ free +. fr. + +$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $ diff --git a/indra/newview/fonts/DejaVuSansMono.ttf b/indra/newview/fonts/DejaVuSansMono.ttf Binary files differnew file mode 100644 index 0000000000..19d188832b --- /dev/null +++ b/indra/newview/fonts/DejaVuSansMono.ttf diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 359e5df4f8..fd473b66d5 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -165,13 +165,6 @@ #include "llcommandlineparser.h" -// annoying detail to determine whether font prefs are over-ridden -#if LL_LINUX -# define LL_DYNAMIC_FONT_DISCOVERY 1 -#else -# define LL_DYNAMIC_FONT_DISCOVERY 0 -#endif - // *FIX: These extern globals should be cleaned up. // The globals either represent state/config/resource-storage of either // this app, or another 'component' of the viewer. App globals should be @@ -1656,12 +1649,6 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setBOOL("AllowMultipleViewers", TRUE); #endif -#if !LL_DYNAMIC_FONT_DISCOVERY - // static font discovery - user settings can override. - gSavedSettings.setString("FontSansSerifFallback", - LLWindow::getFontListSans()); -#endif - //*FIX:Mani - Set default to disabling watchdog mainloop // timeout for mac and linux. There is no call stack info // on these platform to help debug. @@ -1744,20 +1731,14 @@ bool LLAppViewer::initConfiguration() // - load overrides from user_settings loadSettingsFromDirectory("User"); -#if LL_DYNAMIC_FONT_DISCOVERY - // Linux does *dynamic* font discovery which is preferable to - // whatever got written-out into the config file last time. This - // does remove the ability of the user to hand-define the fallbacks - // though, so from a config-management point of view this is hacky. gSavedSettings.setString("FontSansSerifFallback", - LLWindow::getFontListSans()); -#endif + gSavedSettings.getString("FontSansSerifBundledFallback") + ";" + LLWindow::getFontListSans() ); // - apply command line settings clp.notify(); // Handle initialization from settings. - // Start up the debugging console before handling other options. + // Start up the debugging console before handling other options. if (gSavedSettings.getBOOL("ShowConsoleWindow")) { initConsole(); |