mirror of https://github.com/fltk/fltk
I blindly applied this patch to 1.1.10 (I don't have Xft on my Mac...) so please someone check for typos. Thanks. Added Xft Font Lookup Table (STR #2215)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@6871 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
40583190ec
commit
d3557c8e60
1
CHANGES
1
CHANGES
|
@ -1,5 +1,6 @@
|
|||
CHANGES IN FLTK 1.1.10
|
||||
|
||||
- Added Xft2 font lookup table (STR #2215)
|
||||
- Fixed X server "lock", if a modal dialog window is opened
|
||||
while a menu is active (STR #1986)
|
||||
- Updated mirror sites in documentation (STR #2220)
|
||||
|
|
|
@ -291,11 +291,11 @@ double fl_width(uchar c) {
|
|||
static XFontStruct* load_xfont_for_xft2(void) {
|
||||
XFontStruct* xgl_font = 0;
|
||||
int size = fl_size_;
|
||||
char *weight = "medium"; // no specifc weight requested - accept any
|
||||
const char *weight = "medium"; // no specifc weight requested - accept any
|
||||
char slant = 'r'; // regular non-italic by default
|
||||
char xlfd[128]; // we will put our synthetic XLFD in here
|
||||
char *pc = strdup(fl_fonts[fl_font_].name); // what font were we asked for?
|
||||
char *name = pc; // keep a handle to the original name for freeing later
|
||||
const char *name = pc; // keep a handle to the original name for freeing later
|
||||
// Parse the "fltk-name" of the font
|
||||
switch (*name++) {
|
||||
case 'I': slant = 'i'; break; // italic
|
||||
|
@ -305,6 +305,19 @@ static XFontStruct* load_xfont_for_xft2(void) {
|
|||
default: name--; // no prefix, restore name
|
||||
}
|
||||
|
||||
// map generic Xft names to customary XLFD faces
|
||||
if (!strcmp(name, "sans")) {
|
||||
name = "helvetica";
|
||||
} else if (!strcmp(name, "mono")) {
|
||||
name = "courier";
|
||||
} else if (!strcmp(name, "serif")) {
|
||||
name = "times";
|
||||
} else if (!strcmp(name, "screen")) {
|
||||
name = "lucidatypewriter";
|
||||
} else if (!strcmp(name, "dingbats")) {
|
||||
name = "zapf dingbats";
|
||||
}
|
||||
|
||||
// first, we do a query with no prefered size, to see if the font exists at all
|
||||
snprintf(xlfd, 128, "-*-*%s*-%s-%c-*--*-*-*-*-*-*-*-*", name, weight, slant); // make up xlfd style name
|
||||
xgl_font = XLoadQueryFont(fl_display, xlfd);
|
||||
|
|
Loading…
Reference in New Issue