From bee1bc87c4017effdaafd972a4c06186b4038f89 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 3 Mar 2019 19:14:18 +0800 Subject: [PATCH] tune code for size_request of LOGFONT --- src/font/freetype2.c | 5 +++-- src/font/logfont.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/font/freetype2.c b/src/font/freetype2.c index 96c4b8f5..72d1ec44 100644 --- a/src/font/freetype2.c +++ b/src/font/freetype2.c @@ -607,8 +607,9 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont, buffer = get_raster_bitmap_buffer(source->rows * source->pitch); memcpy(buffer, source->buffer, source->rows * source->pitch); - if (sz) { - /* VincentWei: override the bbox.w and bbox.h with bitmap */ + /* VincentWei: override the bbox.w and bbox.h with bitmap */ + if (sz && (source->rows != sz->cy || source->width != sz->cx)) { + _ERR_PRINTF("FreeType2: BITMAP size does not match BBOX\n"); sz->cx = source->width; sz->cy = source->rows; } diff --git a/src/font/logfont.c b/src/font/logfont.c index fe5d89a6..78479d42 100644 --- a/src/font/logfont.c +++ b/src/font/logfont.c @@ -137,13 +137,13 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family, if (newlf->type == NULL || newlf->family == NULL || newlf->charset == NULL) goto error; - newlf->size_request = size; if (size > FONT_MAX_SIZE) newlf->size = FONT_MAX_SIZE; else if (size < FONT_MIN_SIZE) newlf->size = FONT_MIN_SIZE; else newlf->size = size; + newlf->size_request = newlf->size; newlf->rotation = rotation;