mirror of https://github.com/buggins/dlangui.git
increase standard font face priorities when searching for fonts
This commit is contained in:
parent
c718148f93
commit
f1ef6c2544
|
@ -22,6 +22,33 @@ import std.file;
|
||||||
import std.string;
|
import std.string;
|
||||||
import std.utf;
|
import std.utf;
|
||||||
|
|
||||||
|
immutable int[string] STD_FONT_FACES = [
|
||||||
|
"Arial": 12,
|
||||||
|
"Times New Roman": 12,
|
||||||
|
"Courier New": 10,
|
||||||
|
"DejaVu Serif": 10,
|
||||||
|
"DejaVu Sans": 10,
|
||||||
|
"DejaVu Sans Mono": 10,
|
||||||
|
"Liberation Serif": 11,
|
||||||
|
"Liberation Sans": 11,
|
||||||
|
"Liberation Mono": 11,
|
||||||
|
"Verdana": 10,
|
||||||
|
"Menlo": 13,
|
||||||
|
"Consolas": 12,
|
||||||
|
"DejaVuSansMono": 10,
|
||||||
|
"Lucida Sans Typewriter": 10,
|
||||||
|
"Lucida Console": 12,
|
||||||
|
"FreeMono": 8,
|
||||||
|
"FreeSans": 8,
|
||||||
|
"FreeSerif": 8,
|
||||||
|
];
|
||||||
|
|
||||||
|
int stdFontFacePriority(string face) {
|
||||||
|
if (auto p = (face in STD_FONT_FACES))
|
||||||
|
return *p;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// define debug=FontResources for logging of font file resources creation/freeing
|
/// define debug=FontResources for logging of font file resources creation/freeing
|
||||||
//debug = FontResources;
|
//debug = FontResources;
|
||||||
|
|
||||||
|
@ -505,7 +532,7 @@ class FreeTypeFontManager : FontManager {
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return stdFontFacePriority(existing) * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FontFileItem findBestMatch(int weight, bool italic, FontFamily family, string face) {
|
private FontFileItem findBestMatch(int weight, bool italic, FontFamily family, string face) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import dlangui.widgets.styles;
|
||||||
class SourceEdit : EditBox {
|
class SourceEdit : EditBox {
|
||||||
this(string ID) {
|
this(string ID) {
|
||||||
super(ID);
|
super(ID);
|
||||||
fontFace = "Menlo,Consolas,DejaVuSansMono,Lucida Sans Typewriter,Courier New,Lucida Console";
|
fontFace = "Menlo,Consolas,DejaVuSansMono,DejaVu Sans Mono,Liberation Mono,Lucida Sans Typewriter,Courier New,Lucida Console";
|
||||||
//fontFace = "Consolas,Lucida Console,Courier New";
|
//fontFace = "Consolas,Lucida Console,Courier New";
|
||||||
fontFamily = FontFamily.MonoSpace;
|
fontFamily = FontFamily.MonoSpace;
|
||||||
fontSize = makePointSize(10);
|
fontSize = makePointSize(10);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<theme id="theme_default"
|
<theme id="theme_default"
|
||||||
fontSize="9pt"
|
fontSize="9pt"
|
||||||
fontFace="Verdana,Arial,DejaVu Sans"
|
fontFace="Verdana,Arial,DejaVu Sans,Liberation Sans"
|
||||||
fontFamily="SansSerif"
|
fontFamily="SansSerif"
|
||||||
>
|
>
|
||||||
<color id="window_background" value="#FFFFFF"/>
|
<color id="window_background" value="#FFFFFF"/>
|
||||||
|
@ -422,7 +422,8 @@
|
||||||
layoutWidth="FILL_PARENT"
|
layoutWidth="FILL_PARENT"
|
||||||
layoutHeight="WRAP_CONTENT"
|
layoutHeight="WRAP_CONTENT"
|
||||||
align="Left|VCenter"
|
align="Left|VCenter"
|
||||||
textFlags="Parent">
|
textFlags="Parent"
|
||||||
|
>
|
||||||
<state state_default="true" fontWeight="bold"/>
|
<state state_default="true" fontWeight="bold"/>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue