mirror of https://github.com/buggins/dlangui.git
new font hinting mode: Light (mac-like) for freetype
This commit is contained in:
parent
d35498a82d
commit
08de99de59
|
@ -519,7 +519,9 @@ enum HintingMode : int {
|
||||||
/// force autohinting algorithm even if font contains hint data
|
/// force autohinting algorithm even if font contains hint data
|
||||||
AutoHint,
|
AutoHint,
|
||||||
/// disable hinting completely
|
/// disable hinting completely
|
||||||
Disabled
|
Disabled,
|
||||||
|
/// light autohint (similar to Mac)
|
||||||
|
Light
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access points to fonts.
|
/// Access points to fonts.
|
||||||
|
|
|
@ -251,10 +251,10 @@ private class FreeTypeFontFile {
|
||||||
int flags = FT_LOAD_DEFAULT;
|
int flags = FT_LOAD_DEFAULT;
|
||||||
const bool _drawMonochrome = _size < FontManager.minAnitialiasedFontSize;
|
const bool _drawMonochrome = _size < FontManager.minAnitialiasedFontSize;
|
||||||
SubpixelRenderingMode subpixel = _drawMonochrome ? SubpixelRenderingMode.None : FontManager.subpixelRenderingMode;
|
SubpixelRenderingMode subpixel = _drawMonochrome ? SubpixelRenderingMode.None : FontManager.subpixelRenderingMode;
|
||||||
flags |= (!_drawMonochrome ? (subpixel ? FT_LOAD_TARGET_LCD : FT_LOAD_TARGET_NORMAL) : FT_LOAD_TARGET_MONO);
|
flags |= (!_drawMonochrome ? (subpixel ? FT_LOAD_TARGET_LCD : (FontManager.instance.hintingMode == HintingMode.Light ? FT_LOAD_TARGET_LIGHT : FT_LOAD_TARGET_NORMAL)) : FT_LOAD_TARGET_MONO);
|
||||||
if (withImage)
|
if (withImage)
|
||||||
flags |= FT_LOAD_RENDER;
|
flags |= FT_LOAD_RENDER;
|
||||||
if (FontManager.instance.hintingMode == HintingMode.AutoHint)
|
if (FontManager.instance.hintingMode == HintingMode.AutoHint || FontManager.instance.hintingMode == HintingMode.Light)
|
||||||
flags |= FT_LOAD_FORCE_AUTOHINT;
|
flags |= FT_LOAD_FORCE_AUTOHINT;
|
||||||
else if (FontManager.instance.hintingMode == HintingMode.Disabled)
|
else if (FontManager.instance.hintingMode == HintingMode.Disabled)
|
||||||
flags |= FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING;
|
flags |= FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING;
|
||||||
|
@ -498,7 +498,7 @@ class FreeTypeFontManager : FontManager {
|
||||||
Log.e("Cannot init freetype library, error=", error);
|
Log.e("Cannot init freetype library, error=", error);
|
||||||
throw new Exception("Cannot init freetype library");
|
throw new Exception("Cannot init freetype library");
|
||||||
}
|
}
|
||||||
FT_Library_SetLcdFilter(_library, FT_LCD_FILTER_DEFAULT);
|
//FT_Library_SetLcdFilter(_library, FT_LCD_FILTER_DEFAULT);
|
||||||
}
|
}
|
||||||
~this() {
|
~this() {
|
||||||
debug(FontResources) Log.d("FreeTypeFontManager ~this()");
|
debug(FontResources) Log.d("FreeTypeFontManager ~this()");
|
||||||
|
|
|
@ -321,18 +321,18 @@
|
||||||
<style id="TREE_ITEM"
|
<style id="TREE_ITEM"
|
||||||
padding="1,1,1,1"
|
padding="1,1,1,1"
|
||||||
minWidth="100"
|
minWidth="100"
|
||||||
minHeight="16"
|
minHeight="15"
|
||||||
layoutWidth="FILL_PARENT"
|
layoutWidth="FILL_PARENT"
|
||||||
layoutHeight="WRAP_CONTENT"
|
layoutHeight="WRAP_CONTENT"
|
||||||
fontSize="17">
|
fontSize="14">
|
||||||
</style>
|
</style>
|
||||||
<style id="TREE_ITEM_EXPAND_ICON"
|
<style id="TREE_ITEM_EXPAND_ICON"
|
||||||
margins="2,0,2,0"
|
margins="0,0,0,0"
|
||||||
align="Left|VCenter"
|
align="Left|VCenter"
|
||||||
textFlags="Parent"
|
textFlags="Parent"
|
||||||
/>
|
/>
|
||||||
<style id="TREE_ITEM_BODY"
|
<style id="TREE_ITEM_BODY"
|
||||||
margins="2,0,2,0"
|
margins="0,0,0,0"
|
||||||
align="Left|VCenter"
|
align="Left|VCenter"
|
||||||
textFlags="Parent"
|
textFlags="Parent"
|
||||||
backgroundImageId="list_item_background"
|
backgroundImageId="list_item_background"
|
||||||
|
@ -347,7 +347,7 @@
|
||||||
layoutHeight="WRAP_CONTENT"
|
layoutHeight="WRAP_CONTENT"
|
||||||
align="Left|VCenter"
|
align="Left|VCenter"
|
||||||
textFlags="Parent"
|
textFlags="Parent"
|
||||||
fontSize="17"
|
fontSize="14"
|
||||||
/>
|
/>
|
||||||
<style id="RESIZER_VERTICAL"
|
<style id="RESIZER_VERTICAL"
|
||||||
layoutWidth="FILL_PARENT"
|
layoutWidth="FILL_PARENT"
|
||||||
|
|
Loading…
Reference in New Issue