# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1315780360 0 # Node ID 0c073534d722d477b81f0f4cb6832f753064fe69 # Parent cf934fd39d035f517b9e1857be8375b234c0cdef Implemented OS/2 dw_pixmap_set_font() this will need more work... Need to implement sizes like when copying the settings from a window handle like in _CopyFontSettings(). Will revisit this when getting OS/2 printing working... but for now it allows it to compile and basically work. diff -r cf934fd39d03 -r 0c073534d722 os2/dw.c --- a/os2/dw.c Sun Sep 11 22:19:01 2011 +0000 +++ b/os2/dw.c Sun Sep 11 22:32:40 2011 +0000 @@ -8338,7 +8338,7 @@ GpiQueryFontMetrics(hpsSrc, sizeof(FONTMETRICS), &fm); - memset(&fat, 0, sizeof(fat)); + memset(&fat, 0, sizeof(fat)); fat.usRecordLength = sizeof(FATTRS); fat.lMatch = fm.lMatch; @@ -8782,6 +8782,40 @@ } /* + * Sets the font used by a specified pixmap. + * Normally the pixmap font is obtained from the associated window handle. + * However this can be used to override that, or for pixmaps with no window. + * Parameters: + * pixmap: Handle to a pixmap returned by dw_pixmap_new() or + * passed to the application via a callback. + * fontname: Name and size of the font in the form "size.fontname" + * Returns: + * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. + */ +int API dw_pixmap_set_font(HPIXMAP pixmap, char *fontname) +{ + if(pixmap && fontname && *fontname) + { + char *name = strchr(fontname, '.'); + + if(name) + { + FATTRS fat; + + memset(&fat, 0, sizeof(fat)); + + fat.usRecordLength = sizeof(FATTRS); + strcpy(fat.szFacename, name); + + GpiCreateLogFont(pixmap->hps, 0, 1L, &fat); + GpiSetCharSet(pixmap->hps, 1L); + return DW_ERROR_NONE; + } + } + return DW_ERROR_GENERAL; +} + +/* * Destroys an allocated pixmap. * Parameters: * pixmap: Handle to a pixmap returned by