Mercurial > dwindows
comparison os2/dw.c @ 1150:0c073534d722
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.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 11 Sep 2011 22:32:40 +0000 |
parents | e24e5a13ff2c |
children | 58b5374355ab |
comparison
equal
deleted
inserted
replaced
1149:cf934fd39d03 | 1150:0c073534d722 |
---|---|
8336 FATTRS fat; | 8336 FATTRS fat; |
8337 SIZEF sizf; | 8337 SIZEF sizf; |
8338 | 8338 |
8339 GpiQueryFontMetrics(hpsSrc, sizeof(FONTMETRICS), &fm); | 8339 GpiQueryFontMetrics(hpsSrc, sizeof(FONTMETRICS), &fm); |
8340 | 8340 |
8341 memset(&fat, 0, sizeof(fat)); | 8341 memset(&fat, 0, sizeof(fat)); |
8342 | 8342 |
8343 fat.usRecordLength = sizeof(FATTRS); | 8343 fat.usRecordLength = sizeof(FATTRS); |
8344 fat.lMatch = fm.lMatch; | 8344 fat.lMatch = fm.lMatch; |
8345 strcpy(fat.szFacename, fm.szFacename); | 8345 strcpy(fat.szFacename, fm.szFacename); |
8346 | 8346 |
8777 pixmap->transcolor = DW_CLR_DEFAULT; | 8777 pixmap->transcolor = DW_CLR_DEFAULT; |
8778 | 8778 |
8779 WinReleasePS(hps); | 8779 WinReleasePS(hps); |
8780 | 8780 |
8781 return pixmap; | 8781 return pixmap; |
8782 } | |
8783 | |
8784 /* | |
8785 * Sets the font used by a specified pixmap. | |
8786 * Normally the pixmap font is obtained from the associated window handle. | |
8787 * However this can be used to override that, or for pixmaps with no window. | |
8788 * Parameters: | |
8789 * pixmap: Handle to a pixmap returned by dw_pixmap_new() or | |
8790 * passed to the application via a callback. | |
8791 * fontname: Name and size of the font in the form "size.fontname" | |
8792 * Returns: | |
8793 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. | |
8794 */ | |
8795 int API dw_pixmap_set_font(HPIXMAP pixmap, char *fontname) | |
8796 { | |
8797 if(pixmap && fontname && *fontname) | |
8798 { | |
8799 char *name = strchr(fontname, '.'); | |
8800 | |
8801 if(name) | |
8802 { | |
8803 FATTRS fat; | |
8804 | |
8805 memset(&fat, 0, sizeof(fat)); | |
8806 | |
8807 fat.usRecordLength = sizeof(FATTRS); | |
8808 strcpy(fat.szFacename, name); | |
8809 | |
8810 GpiCreateLogFont(pixmap->hps, 0, 1L, &fat); | |
8811 GpiSetCharSet(pixmap->hps, 1L); | |
8812 return DW_ERROR_NONE; | |
8813 } | |
8814 } | |
8815 return DW_ERROR_GENERAL; | |
8782 } | 8816 } |
8783 | 8817 |
8784 /* | 8818 /* |
8785 * Destroys an allocated pixmap. | 8819 * Destroys an allocated pixmap. |
8786 * Parameters: | 8820 * Parameters: |