fixbug of FT2 subpixel glyph rendering

This commit is contained in:
Vincent Wei
2019-04-29 17:34:45 +08:00
parent 1d211ed855
commit ee5a1f86a7
4 changed files with 52 additions and 53 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ Please report any bugs and incompatibilities in
* macro: `_MGUSE_SYNC_UPDATE`
1. New API `UpdateInvalidClient`. You can use this function to update
the invalid client region of a window instantly.
1. New API `LoadDevFontFromFile`. You can use this function to load
1. New API `LoadDevFontFromIncoreData`. You can use this function to load
a device font from incore data.
1. Use different colors for the output of `_DBG_PRINTF` and `_ERR_PRINTF`.
1. Add `__mg_save_jpg` function for storing MYBITMAP as JPEG file (10km).
+46 -49
View File
@@ -2726,6 +2726,7 @@ MG_EXPORT HCURSOR GUIAPI GetSystemCursor (int csrid);
* \return Handle to the current system cursor, zero means no current cursor.
*/
MG_EXPORT HCURSOR GUIAPI GetCurrentCursor (void);
#else
static inline HCURSOR LoadCursorFromFile(const char* filename) {
@@ -2860,6 +2861,7 @@ MG_EXPORT void GUIAPI GetCursorPos (POINT* ppt);
MG_EXPORT void GUIAPI SetCursorPos (int x, int y);
#ifdef _MGHAVE_CURSOR
/**
* \fn HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL set_def)
* \brief Changes the current cursor.
@@ -2878,7 +2880,7 @@ MG_EXPORT void GUIAPI SetCursorPos (int x, int y);
*
* \sa SetCursor, SetDefaultCursor, GetDefaultCursor
*/
MG_EXPORT HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL set_def);
MG_EXPORT HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL set_def);
/**
* \fn HCURSOR GUIAPI GetDefaultCursor (void)
@@ -2892,52 +2894,6 @@ MG_EXPORT void GUIAPI SetCursorPos (int x, int y);
*/
MG_EXPORT HCURSOR GUIAPI GetDefaultCursor (void);
#else
static inline HCURSOR SetCursorEx(HCURSOR hcsr, BOOL set_def) {
return (HCURSOR)0;
}
static inline HCURSOR GetDefaultCursor(void) {
return (HCURSOR)0;
}
#endif /* _MGHAVE_CURSOR */
/**
* \def SetCursor(hcsr)
* \brief Changes the current cursor.
*
* This function changes the current cursor to be \a hcsr.
*
* \param hcsr The expected cursor handle.
* \return The old cursor handle.
*
* \note This function defined as a macro calling \a SetCursorEx with
* passing \a set_def as FALSE.
*
* \sa SetCursorEx, SetDefaultCursor
*/
#define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)
/**
* \def SetDefaultCursor(hcsr)
* \brief Changes the current cursor, and set it as the default cursor.
*
* This function changes the current cursor to be \a hcsr, and set it as
* the default cursor.
*
* \param hcsr The expected cursor handle.
* \return The old cursor handle.
*
* \note This function defined as a macro calling \a SetCursorEx with
* passing \a set_def as TRUE.
*
* \sa SetCursorEx, SetCursor
*/
#define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)
#ifdef _MGHAVE_CURSOR
/**
* \fn int GUIAPI ShowCursor (BOOL fShow)
* \brief Shows or hides cursor.
@@ -2954,13 +2910,54 @@ static inline HCURSOR GetDefaultCursor(void) {
*/
MG_EXPORT int GUIAPI ShowCursor (BOOL fShow);
#else
#else /* _MGHAVE_CURSOR */
static inline HCURSOR SetCursorEx(HCURSOR hcsr, BOOL set_def) {
return (HCURSOR)0;
}
static inline HCURSOR GetDefaultCursor(void) {
return (HCURSOR)0;
}
static inline int GUIAPI ShowCursor (BOOL fShow) {
return 0;
}
#endif /* _MGHAVE_CURSOR */
#endif /* !_MGHAVE_CURSOR */
/**
* \def SetCursor(hcsr)
* \brief Changes the current cursor.
*
* This function changes the current cursor to be \a hcsr.
*
* \param hcsr The expected cursor handle.
* \return The old cursor handle.
*
* \note This function defined as a macro calling \a SetCursorEx with
* passing \a set_def as FALSE.
*
* \sa SetCursorEx, SetDefaultCursor
*/
#define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)
/**
* \def SetDefaultCursor(hcsr)
* \brief Changes the current cursor, and set it as the default cursor.
*
* This function changes the current cursor to be \a hcsr, and set it as
* the default cursor.
*
* \param hcsr The expected cursor handle.
* \return The old cursor handle.
*
* \note This function defined as a macro calling \a SetCursorEx with
* passing \a set_def as TRUE.
*
* \sa SetCursorEx, SetCursor
*/
#define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)
/** @} end of cursor_fns */
+3 -3
View File
@@ -511,7 +511,7 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont,
if (pitch)
*pitch = cacheinfo->pitch;
if (!is_grey && sz) {
if (sz) {
sz->cx = cacheinfo->width;
sz->cy = cacheinfo->height;
}
@@ -592,7 +592,7 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont,
pcache->flag = TRUE;
}
if (!is_grey && sz) {
if (sz) {
sz->cx = pcache->width;
sz->cy = pcache->height;
}
@@ -604,7 +604,7 @@ 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 (!is_grey && sz) {
if (sz) {
sz->cx = source->width;
sz->cy = source->rows;
}
+2
View File
@@ -3786,6 +3786,8 @@ static BOOL _gdi_get_glyph_data (PDC pdc, Glyph32 glyph_value,
/* the returned bits will be the subpixled pixmap */
data = (BYTE*)(*devfont->font_ops->get_glyph_greybitmap) (logfont, devfont,
REAL_GLYPH(glyph_value), bbox, &pitch, &scale);
// the width of SUBPIXEL bitmap is 3x real width of bbox
bbox->cx /= 3;
ctxt->cb = _dc_ft2subpixel_scan_line;
}
#endif