~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/gdiplus/font.c

Version: ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * Copyright (C) 2007 Google (Evan Stade)
  3  *
  4  * This library is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2.1 of the License, or (at your option) any later version.
  8  *
  9  * This library is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with this library; if not, write to the Free Software
 16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 17  */
 18 
 19 #include <stdarg.h>
 20 
 21 #include "windef.h"
 22 #include "winbase.h"
 23 #include "wingdi.h"
 24 #include "winnls.h"
 25 #include "winreg.h"
 26 #include "wine/debug.h"
 27 #include "wine/unicode.h"
 28 
 29 WINE_DEFAULT_DEBUG_CHANNEL (gdiplus);
 30 
 31 #include "objbase.h"
 32 
 33 #include "gdiplus.h"
 34 #include "gdiplus_private.h"
 35 
 36 static const REAL mm_per_inch = 25.4;
 37 static const REAL inch_per_point = 1.0/72.0;
 38 
 39 static inline REAL get_dpi (void)
 40 {
 41     REAL dpi;
 42     GpGraphics *graphics;
 43     HDC hdc = GetDC(0);
 44     GdipCreateFromHDC (hdc, &graphics);
 45     GdipGetDpiX(graphics, &dpi);
 46     GdipDeleteGraphics(graphics);
 47     ReleaseDC (0, hdc);
 48 
 49     return dpi;
 50 }
 51 
 52 static inline REAL point_to_pixel (REAL point)
 53 {
 54     return point * get_dpi() * inch_per_point;
 55 }
 56 
 57 static inline REAL inch_to_pixel (REAL inch)
 58 {
 59     return inch * get_dpi();
 60 }
 61 
 62 static inline REAL document_to_pixel (REAL doc)
 63 {
 64     return doc * (get_dpi() / 300.0); /* Per MSDN */
 65 }
 66 
 67 static inline REAL mm_to_pixel (REAL mm)
 68 {
 69     return mm * (get_dpi() / mm_per_inch);
 70 }
 71 
 72 /*******************************************************************************
 73  * GdipCreateFont [GDIPLUS.@]
 74  *
 75  * Create a new font based off of a FontFamily
 76  *
 77  * PARAMS
 78  *  *fontFamily     [I] Family to base the font off of
 79  *  emSize          [I] Size of the font
 80  *  style           [I] Bitwise OR of FontStyle enumeration
 81  *  unit            [I] Unit emSize is measured in
 82  *  **font          [I] the resulting Font object
 83  *
 84  * RETURNS
 85  *  SUCCESS: Ok
 86  *  FAILURE: InvalidParameter if fontfamily or font is NULL.
 87  *  FAILURE: FontFamilyNotFound if an invalid FontFamily is given
 88  *
 89  * NOTES
 90  *  UnitDisplay is unsupported.
 91  *  emSize is stored separately from lfHeight, to hold the fraction.
 92  */
 93 GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
 94                         REAL emSize, INT style, Unit unit, GpFont **font)
 95 {
 96     WCHAR facename[LF_FACESIZE];
 97     LOGFONTW* lfw;
 98     const NEWTEXTMETRICW* tmw;
 99     GpStatus stat;
100 
101     if (!fontFamily || !font)
102         return InvalidParameter;
103 
104     TRACE("%p (%s), %f, %d, %d, %p\n", fontFamily,
105             debugstr_w(fontFamily->FamilyName), emSize, style, unit, font);
106 
107     stat = GdipGetFamilyName (fontFamily, facename, 0);
108     if (stat != Ok) return stat;
109     *font = GdipAlloc(sizeof(GpFont));
110 
111     tmw = &fontFamily->tmw;
112     lfw = &((*font)->lfw);
113     ZeroMemory(&(*lfw), sizeof(*lfw));
114 
115     lfw->lfWeight = tmw->tmWeight;
116     lfw->lfItalic = tmw->tmItalic;
117     lfw->lfUnderline = tmw->tmUnderlined;
118     lfw->lfStrikeOut = tmw->tmStruckOut;
119     lfw->lfCharSet = tmw->tmCharSet;
120     lfw->lfPitchAndFamily = tmw->tmPitchAndFamily;
121     lstrcpynW(lfw->lfFaceName, facename, LF_FACESIZE);
122 
123     switch (unit)
124     {
125         case UnitWorld:
126             /* FIXME: Figure out when World != Pixel */
127             lfw->lfHeight = emSize; break;
128         case UnitDisplay:
129             FIXME("Unknown behavior for UnitDisplay! Please report!\n");
130             /* FIXME: Figure out how this works...
131              * MSDN says that if "DISPLAY" is a monitor, then pixel should be
132              * used. That's not what I got. Tests on Windows revealed no output,
133              * and the tests in tests/font crash windows */
134             lfw->lfHeight = 0; break;
135         case UnitPixel:
136             lfw->lfHeight = emSize; break;
137         case UnitPoint:
138             lfw->lfHeight = point_to_pixel(emSize); break;
139         case UnitInch:
140             lfw->lfHeight = inch_to_pixel(emSize); break;
141         case UnitDocument:
142             lfw->lfHeight = document_to_pixel(emSize); break;
143         case UnitMillimeter:
144             lfw->lfHeight = mm_to_pixel(emSize); break;
145     }
146 
147     lfw->lfHeight *= -1;
148 
149     lfw->lfWeight = style & FontStyleBold ? 700 : 400;
150     lfw->lfItalic = style & FontStyleItalic;
151     lfw->lfUnderline = style & FontStyleUnderline;
152     lfw->lfStrikeOut = style & FontStyleStrikeout;
153 
154     (*font)->unit = unit;
155     (*font)->emSize = emSize;
156 
157     return Ok;
158 }
159 
160 GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
161     GDIPCONST LOGFONTW *logfont, GpFont **font)
162 {
163     HFONT hfont, oldfont;
164     TEXTMETRICW textmet;
165 
166     if(!logfont || !font)
167         return InvalidParameter;
168 
169     *font = GdipAlloc(sizeof(GpFont));
170     if(!*font)  return OutOfMemory;
171 
172     memcpy((*font)->lfw.lfFaceName, logfont->lfFaceName, LF_FACESIZE *
173            sizeof(WCHAR));
174     (*font)->lfw.lfHeight = logfont->lfHeight;
175     (*font)->lfw.lfItalic = logfont->lfItalic;
176     (*font)->lfw.lfUnderline = logfont->lfUnderline;
177     (*font)->lfw.lfStrikeOut = logfont->lfStrikeOut;
178 
179     (*font)->emSize = logfont->lfHeight;
180     (*font)->unit = UnitPixel;
181 
182     hfont = CreateFontIndirectW(&(*font)->lfw);
183     oldfont = SelectObject(hdc, hfont);
184     GetTextMetricsW(hdc, &textmet);
185 
186     (*font)->lfw.lfHeight = -textmet.tmHeight;
187     (*font)->lfw.lfWeight = textmet.tmWeight;
188 
189     SelectObject(hdc, oldfont);
190     DeleteObject(hfont);
191 
192     return Ok;
193 }
194 
195 GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC hdc,
196     GDIPCONST LOGFONTA *lfa, GpFont **font)
197 {
198     LOGFONTW lfw;
199 
200     if(!lfa || !font)
201         return InvalidParameter;
202 
203     memcpy(&lfw, lfa, FIELD_OFFSET(LOGFONTA,lfFaceName) );
204 
205     if(!MultiByteToWideChar(CP_ACP, 0, lfa->lfFaceName, -1, lfw.lfFaceName, LF_FACESIZE))
206         return GenericError;
207 
208     GdipCreateFontFromLogfontW(hdc, &lfw, font);
209 
210     return Ok;
211 }
212 
213 GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)
214 {
215     if(!font)
216         return InvalidParameter;
217 
218     GdipFree(font);
219 
220     return Ok;
221 }
222 
223 GpStatus WINGDIPAPI GdipCreateFontFromDC(HDC hdc, GpFont **font)
224 {
225     HFONT hfont;
226     LOGFONTW lfw;
227 
228     if(!font)
229         return InvalidParameter;
230 
231     hfont = (HFONT)GetCurrentObject(hdc, OBJ_FONT);
232     if(!hfont)
233         return GenericError;
234 
235     if(!GetObjectW(hfont, sizeof(LOGFONTW), &lfw))
236         return GenericError;
237 
238     return GdipCreateFontFromLogfontW(hdc, &lfw, font);
239 }
240 
241 /******************************************************************************
242  * GdipGetFontSize [GDIPLUS.@]
243  *
244  * Returns the size of the font in Units
245  *
246  * PARAMS
247  *  *font       [I] The font to retrieve size from
248  *  *size       [O] Pointer to hold retrieved value
249  *
250  * RETURNS
251  *  SUCCESS: Ok
252  *  FAILURE: InvalidParamter (font or size was NULL)
253  *
254  * NOTES
255  *  Size returned is actually emSize -- not internal size used for drawing.
256  */
257 GpStatus WINGDIPAPI GdipGetFontSize(GpFont *font, REAL *size)
258 {
259     if (!(font && size)) return InvalidParameter;
260 
261     *size = font->emSize;
262 
263     return Ok;
264 }
265 
266 /*******************************************************************************
267  * GdipGetFontUnit  [GDIPLUS.@]
268  *
269  * PARAMS
270  *  font    [I] Font to retrieve from
271  *  unit    [O] Return value
272  *
273  * RETURNS
274  *  FAILURE: font or unit was NULL
275  *  OK: otherwise
276  */
277 GpStatus WINGDIPAPI GdipGetFontUnit(GpFont *font, Unit *unit)
278 {
279     if (!(font && unit)) return InvalidParameter;
280 
281     *unit = font->unit;
282 
283     return Ok;
284 }
285 
286 /* FIXME: use graphics */
287 GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
288     LOGFONTW *lfw)
289 {
290     if(!font || !graphics || !lfw)
291         return InvalidParameter;
292 
293     *lfw = font->lfw;
294 
295     return Ok;
296 }
297 
298 GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
299 {
300     if(!font || !cloneFont)
301         return InvalidParameter;
302 
303     *cloneFont = GdipAlloc(sizeof(GpFont));
304     if(!*cloneFont)    return OutOfMemory;
305 
306     **cloneFont = *font;
307 
308     return Ok;
309 }
310 
311 /*******************************************************************************
312  * GdipGetFontHeightGivenDPI [GDIPLUS.@]
313  * PARAMS
314  *  font        [I] Font to retrieve DPI from
315  *  dpi         [I] DPI to assume
316  *  height      [O] Return value
317  *
318  * RETURNS
319  *  SUCCESS: Ok
320  *  FAILURE: InvalidParameter if font or height is NULL
321  *
322  * NOTES
323  *  According to MSDN, the result is (lineSpacing)*(fontSize / emHeight)*dpi
324  *  (for anything other than unit Pixel)
325  */
326 GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height)
327 {
328     if (!(font && height)) return InvalidParameter;
329 
330     FIXME("%p (%s), %f, %p\n", font,
331             debugstr_w(font->lfw.lfFaceName), dpi, height);
332 
333     return NotImplemented;
334 }
335 
336 /***********************************************************************
337  * Borrowed from GDI32:
338  *
339  * Elf is really an ENUMLOGFONTEXW, and ntm is a NEWTEXTMETRICEXW.
340  *     We have to use other types because of the FONTENUMPROCW definition.
341  */
342 static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf,
343                             const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
344 {
345     if (!ntm)
346     {
347         return 1;
348     }
349 
350     *(NEWTEXTMETRICW*)lParam = *(const NEWTEXTMETRICW*)ntm;
351 
352     return 0;
353 }
354 
355 static BOOL find_installed_font(const WCHAR *name, NEWTEXTMETRICW *ntm)
356 {
357     HDC hdc = GetDC(0);
358     BOOL ret = FALSE;
359 
360     if(!EnumFontFamiliesW(hdc, name, is_font_installed_proc, (LPARAM)ntm))
361         ret = TRUE;
362 
363     ReleaseDC(0, hdc);
364     return ret;
365 }
366 
367 /*******************************************************************************
368  * GdipCreateFontFamilyFromName [GDIPLUS.@]
369  *
370  * Creates a font family object based on a supplied name
371  *
372  * PARAMS
373  *  name               [I] Name of the font
374  *  fontCollection     [I] What font collection (if any) the font belongs to (may be NULL)
375  *  FontFamily         [O] Pointer to the resulting FontFamily object
376  *
377  * RETURNS
378  *  SUCCESS: Ok
379  *  FAILURE: FamilyNotFound if the requested FontFamily does not exist on the system
380  *  FAILURE: Invalid parameter if FontFamily or name is NULL
381  *
382  * NOTES
383  *   If fontCollection is NULL then the object is not part of any collection
384  *
385  */
386 
387 GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
388                                         GpFontCollection *fontCollection,
389                                         GpFontFamily **FontFamily)
390 {
391     GpFontFamily* ffamily;
392     NEWTEXTMETRICW ntm;
393 
394     TRACE("%s, %p %p\n", debugstr_w(name), fontCollection, FontFamily);
395 
396     if (!(name && FontFamily))
397         return InvalidParameter;
398     if (fontCollection)
399         FIXME("No support for FontCollections yet!\n");
400 
401     if (!find_installed_font(name, &ntm))
402         return FontFamilyNotFound;
403 
404     ffamily = GdipAlloc(sizeof (GpFontFamily));
405     if (!ffamily) return OutOfMemory;
406 
407     ffamily->tmw = ntm;
408     lstrcpynW(ffamily->FamilyName, name, LF_FACESIZE);
409 
410     *FontFamily = ffamily;
411 
412     return Ok;
413 }
414 
415 /*******************************************************************************
416  * GdipCloneFontFamily [GDIPLUS.@]
417  *
418  * Creates a deep copy of a Font Family object
419  *
420  * PARAMS
421  *  FontFamily          [I] Font to clone
422  *  clonedFontFamily    [O] The resulting cloned font
423  *
424  * RETURNS
425  *  SUCCESS: Ok
426  */
427 GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily* FontFamily, GpFontFamily** clonedFontFamily)
428 {
429     if (!(FontFamily && clonedFontFamily)) return InvalidParameter;
430 
431     TRACE("stub: %p (%s), %p\n", FontFamily,
432             debugstr_w(FontFamily->FamilyName), clonedFontFamily);
433 
434     *clonedFontFamily = GdipAlloc(sizeof(GpFontFamily));
435     if (!*clonedFontFamily) return OutOfMemory;
436 
437     (*clonedFontFamily)->tmw = FontFamily->tmw;
438     lstrcpyW((*clonedFontFamily)->FamilyName, FontFamily->FamilyName);
439 
440     return Ok;
441 }
442 
443 /*******************************************************************************
444  * GdipGetFamilyName [GDIPLUS.@]
445  *
446  * Returns the family name into name
447  *
448  * PARAMS
449  *  *family     [I] Family to retrieve from
450  *  *name       [O] WCHARS of the family name
451  *  LANGID      [I] charset
452  *
453  * RETURNS
454  *  SUCCESS: Ok
455  *  FAILURE: InvalidParameter if family is NULL
456  *
457  * NOTES
458  *   If name is a NULL ptr, then both XP and Vista will crash (so we do as well)
459  */
460 GpStatus WINGDIPAPI GdipGetFamilyName (GDIPCONST GpFontFamily *family,
461                                        WCHAR *name, LANGID language)
462 {
463     if (family == NULL)
464          return InvalidParameter;
465 
466     TRACE("%p, %p, %d\n", family, name, language);
467 
468     if (language != LANG_NEUTRAL)
469         FIXME("No support for handling of multiple languages!\n");
470 
471     lstrcpynW (name, family->FamilyName, LF_FACESIZE);
472 
473     return Ok;
474 }
475 
476 
477 /*****************************************************************************
478  * GdipDeleteFontFamily [GDIPLUS.@]
479  *
480  * Removes the specified FontFamily
481  *
482  * PARAMS
483  *  *FontFamily         [I] The family to delete
484  *
485  * RETURNS
486  *  SUCCESS: Ok
487  *  FAILURE: InvalidParameter if FontFamily is NULL.
488  *
489  */
490 GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
491 {
492     if (!FontFamily)
493         return InvalidParameter;
494     TRACE("Deleting %p (%s)\n", FontFamily, debugstr_w(FontFamily->FamilyName));
495 
496     GdipFree (FontFamily);
497 
498     return Ok;
499 }
500 
501 GpStatus WINGDIPAPI GdipGetCellAscent(GDIPCONST GpFontFamily *family,
502         INT style, UINT16* CellAscent)
503 {
504     if (!(family && CellAscent)) return InvalidParameter;
505 
506     *CellAscent = family->tmw.tmAscent;
507 
508     return Ok;
509 }
510 
511 GpStatus WINGDIPAPI GdipGetCellDescent(GDIPCONST GpFontFamily *family,
512         INT style, UINT16* CellDescent)
513 {
514     if (!(family && CellDescent)) return InvalidParameter;
515 
516     *CellDescent = family->tmw.tmDescent;
517 
518     return Ok;
519 }
520 
521 /*******************************************************************************
522  * GdipGetEmHeight [GDIPLUS.@]
523  *
524  * Gets the height of the specified family in EmHeights
525  *
526  * PARAMS
527  *  family      [I] Family to retrieve from
528  *  style       [I] (optional) style
529  *  EmHeight    [O] return value
530  *
531  * RETURNS
532  *  SUCCESS: Ok
533  *  FAILURE: InvalidParameter
534  */
535 GpStatus WINGDIPAPI GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16* EmHeight)
536 {
537     if (!(family && EmHeight)) return InvalidParameter;
538 
539     TRACE("%p (%s), %d, %p, stub!\n", family,
540             debugstr_w(family->FamilyName), style, EmHeight);
541 
542     *EmHeight = family->tmw.ntmSizeEM;
543 
544     return Ok;
545 }
546 
547 
548 /*******************************************************************************
549  * GdipGetLineSpacing [GDIPLUS.@]
550  *
551  * Returns the line spacing in design units
552  *
553  * PARAMS
554  *  family      [I] Family to retrieve from
555  *  style       [I] (Optional) font style
556  *  LineSpacing [O] Return value
557  *
558  * RETURNS
559  *  SUCCESS: Ok
560  *  FAILURE: InvalidParameter (family or LineSpacing was NULL)
561  */
562 GpStatus WINGDIPAPI GdipGetLineSpacing(GDIPCONST GpFontFamily *family,
563         INT style, UINT16* LineSpacing)
564 {
565     if (!(family && LineSpacing)) return InvalidParameter;
566 
567     FIXME("stub!\n");
568 
569     return NotImplemented;
570 }
571 
572 /*****************************************************************************
573  * GdipGetGenericFontFamilyMonospace [GDIPLUS.@]
574  *
575  * Obtains a serif family (Courier New on Windows)
576  *
577  * PARAMS
578  *  **nativeFamily         [I] Where the font will be stored
579  *
580  * RETURNS
581  *  InvalidParameter if nativeFamily is NULL.
582  *  Ok otherwise.
583  */
584 GpStatus WINGDIPAPI GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily)
585 {
586     static const WCHAR CourierNew[] = {'C','o','u','r','i','e','r',' ','N','e','w','\0'};
587 
588     if (nativeFamily == NULL) return InvalidParameter;
589 
590     return GdipCreateFontFamilyFromName(CourierNew, NULL, nativeFamily);
591 }
592 
593 /*****************************************************************************
594  * GdipGetGenericFontFamilySerif [GDIPLUS.@]
595  *
596  * Obtains a serif family (Times New Roman on Windows)
597  *
598  * PARAMS
599  *  **nativeFamily         [I] Where the font will be stored
600  *
601  * RETURNS
602  *  InvalidParameter if nativeFamily is NULL.
603  *  Ok otherwise.
604  */
605 GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily)
606 {
607     static const WCHAR TimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
608 
609     if (nativeFamily == NULL) return InvalidParameter;
610 
611     return GdipCreateFontFamilyFromName(TimesNewRoman, NULL, nativeFamily);
612 }
613 
614 /*****************************************************************************
615  * GdipGetGenericFontFamilySansSerif [GDIPLUS.@]
616  *
617  * Obtains a serif family (Microsoft Sans Serif on Windows)
618  *
619  * PARAMS
620  *  **nativeFamily         [I] Where the font will be stored
621  *
622  * RETURNS
623  *  InvalidParameter if nativeFamily is NULL.
624  *  Ok otherwise.
625  */
626 GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily)
627 {
628     /* FIXME: On Windows this is called Microsoft Sans Serif, this shouldn't
629      * affect anything */
630     static const WCHAR MSSansSerif[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
631 
632     if (nativeFamily == NULL) return InvalidParameter;
633 
634     return GdipCreateFontFamilyFromName(MSSansSerif, NULL, nativeFamily);
635 }
636 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.