summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixRFont.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-15 14:56:05 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-15 14:56:05 (GMT)
commit002b62783852b8976a99c3c335c02a9e7b2620b5 (patch)
treee917ce2bb4fc8961d0de782ce87d967679bb4de5 /unix/tkUnixRFont.c
parent8b59cb5249fe45bac39e65cb724d77b434168d9f (diff)
downloadtk-002b62783852b8976a99c3c335c02a9e7b2620b5.zip
tk-002b62783852b8976a99c3c335c02a9e7b2620b5.tar.gz
tk-002b62783852b8976a99c3c335c02a9e7b2620b5.tar.bz2
Another attempt to fix [434d294df8b053246ee86e7898d06bc3a6d1d771|434d294df8], this time (hopefully) suitable for 8.6. (less changes than the original attempt)
Diffstat (limited to 'unix/tkUnixRFont.c')
-rw-r--r--unix/tkUnixRFont.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 41cd096..b818a70 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -170,18 +170,21 @@ GetTkFontAttributes(
{
const char *family = "Unknown";
const char *const *familyPtr = &family;
- int weight, slant, size, pxsize;
- double ptsize;
+ int weight, slant, pxsize;
+ double size, ptsize;
(void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr);
if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
&ptsize) == XftResultMatch) {
- size = (int) ptsize;
+ size = ptsize;
+ } else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0,
+ &ptsize) == XftResultMatch) {
+ size = -ptsize;
} else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0,
&pxsize) == XftResultMatch) {
size = -pxsize;
} else {
- size = 12;
+ size = 12.0;
}
if (XftPatternGetInteger(ftFont->pattern, XFT_WEIGHT, 0,
&weight) != XftResultMatch) {
@@ -194,7 +197,7 @@ GetTkFontAttributes(
#if DEBUG_FONTSEL
printf("family %s size %d weight %d slant %d\n",
- family, size, weight, slant);
+ family, (int)size, weight, slant);
#endif /* DEBUG_FONTSEL */
faPtr->family = Tk_GetUid(family);
@@ -441,10 +444,10 @@ TkpGetFontFromAttributes(
if (faPtr->family) {
XftPatternAddString(pattern, XFT_FAMILY, faPtr->family);
}
- if (faPtr->size > 0) {
- XftPatternAddDouble(pattern, XFT_SIZE, (double)faPtr->size);
- } else if (faPtr->size < 0) {
- XftPatternAddInteger(pattern, XFT_PIXEL_SIZE, -faPtr->size);
+ if (faPtr->size > 0.0) {
+ XftPatternAddDouble(pattern, XFT_SIZE, faPtr->size);
+ } else if (faPtr->size < 0.0) {
+ XftPatternAddDouble(pattern, XFT_PIXEL_SIZE, -faPtr->size);
} else {
XftPatternAddDouble(pattern, XFT_SIZE, 12.0);
}