Fix value renaming. Cleanup code, fix a few leaks.
[wine/multimedia.git] / graphics / fontengine.c
blobe0f3bb1ba144d6167ad7010382792aeee3a77f61
1 /*
2 * True Type font engine support
4 * Copyright 1996 John Harvey
5 * Copyright 1998 David Lee Lambert
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <math.h>
22 #include <stdarg.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wine/wingdi16.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(font);
32 /***********************************************************************
33 * EngineEnumerateFont (GDI.300)
35 WORD WINAPI
36 EngineEnumerateFont16(LPSTR fontname, FARPROC16 proc, DWORD data )
38 FIXME("(%s,%p,%lx),stub\n",fontname,proc,data);
39 return 0;
42 /***********************************************************************
43 * EngineDeleteFont (GDI.301)
45 WORD WINAPI EngineDeleteFont16(LPFONTINFO16 lpFontInfo)
47 WORD handle;
49 /* untested, don't know if it works.
50 We seem to access some structure that is located after the
51 FONTINFO. The FONTINFO documentation says that there may
52 follow some char-width table or font bitmap or vector info.
53 I think it is some kind of font bitmap that begins at offset 0x52,
54 as FONTINFO goes up to 0x51.
55 If this is correct, everything should be implemented correctly.
57 if ( ((lpFontInfo->dfType & (RASTER_FONTTYPE|DEVICE_FONTTYPE))
58 == (RASTER_FONTTYPE|DEVICE_FONTTYPE))
59 && (LOWORD(lpFontInfo->dfFace) == LOWORD(lpFontInfo)+0x6e)
60 && (handle = *(WORD *)(lpFontInfo+0x54)) )
62 *(WORD *)(lpFontInfo+0x54) = 0;
63 GlobalFree16(handle);
65 return 1;
68 /***********************************************************************
69 * EngineRealizeFont (GDI.302)
71 WORD WINAPI EngineRealizeFont16(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo)
73 FIXME("(%p,%p,%p),stub\n",lplogFont,lptextxform,lpfontInfo);
75 return 0;
78 /***********************************************************************
79 * EngineRealizeFontExt (GDI.315)
81 WORD WINAPI EngineRealizeFontExt16(LONG l1, LONG l2, LONG l3, LONG l4)
83 FIXME("(%08lx,%08lx,%08lx,%08lx),stub\n",l1,l2,l3,l4);
85 return 0;
88 /***********************************************************************
89 * EngineGetCharWidth (GDI.303)
91 WORD WINAPI EngineGetCharWidth16(LPFONTINFO16 lpFontInfo, BYTE firstChar, BYTE lastChar, LPINT16 buffer)
93 int i;
95 for (i = firstChar; i <= lastChar; i++)
96 FIXME(" returns font's average width for range %d to %d\n", firstChar, lastChar);
97 *buffer++ = lpFontInfo->dfAvgWidth; /* insert some charwidth functionality here; use average width for now */
98 return 1;
101 /***********************************************************************
102 * EngineSetFontContext (GDI.304)
104 WORD WINAPI EngineSetFontContext(LPFONTINFO16 lpFontInfo, WORD data)
106 FIXME("stub?\n");
107 return 0;
110 /***********************************************************************
111 * EngineGetGlyphBMP (GDI.305)
113 WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2, LPSTR string, DWORD dword, /*LPBITMAPMETRICS16*/ LPVOID metrics)
115 FIXME("stub?\n");
116 return 0;
119 /***********************************************************************
120 * EngineMakeFontDir (GDI.306)
122 DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string)
124 FIXME(" stub! (always fails)\n");
125 return -1; /* error */