ReactOS 0.4.17-dev-218-g5635d24
font.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007 Google (Evan Stade)
3 * Copyright (C) 2012 Dmitry Timoshkov
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include <stdarg.h>
21
22#include "windef.h"
23#include "winbase.h"
24#include "wingdi.h"
25#include "winnls.h"
26#include "winreg.h"
27#include "wine/debug.h"
28
30
31#include "objbase.h"
32
33#include "gdiplus.h"
34#include "gdiplus_private.h"
35
36/* PANOSE is 10 bytes in size, need to pack the structure properly */
37#include "pshpack2.h"
38typedef struct
39{
61 CHAR achVendID[4];
65 /* According to the Apple spec, original version didn't have the below fields,
66 * version numbers were taken from the OpenType spec.
67 */
68 /* version 0 (TrueType 1.5) */
74 /* version 1 (TrueType 1.66) */
77 /* version 2 (OpenType 1.2) */
83} TT_OS2_V2;
84
85typedef struct
86{
101} TT_HHEA;
102#include "poppack.h"
103
104#ifdef WORDS_BIGENDIAN
105#define GET_BE_WORD(x) (x)
106#define GET_BE_DWORD(x) (x)
107#else
108#define GET_BE_WORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x))
109#define GET_BE_DWORD(x) MAKELONG(GET_BE_WORD(HIWORD(x)), GET_BE_WORD(LOWORD(x)))
110#endif
111
112#define MS_MAKE_TAG(ch0, ch1, ch2, ch3) \
113 ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
114 ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24))
115#define MS_OS2_TAG MS_MAKE_TAG('O','S','/','2')
116#define MS_HHEA_TAG MS_MAKE_TAG('h','h','e','a')
117
119
122{
123 0, 0, &font_cs,
125 0, 0, { (DWORD_PTR)(__FILE__ ": font_cs") }
126};
127static CRITICAL_SECTION font_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
128
129/*******************************************************************************
130 * GdipCreateFont [GDIPLUS.@]
131 *
132 * Create a new font based off of a FontFamily
133 *
134 * PARAMS
135 * *fontFamily [I] Family to base the font off of
136 * emSize [I] Size of the font
137 * style [I] Bitwise OR of FontStyle enumeration
138 * unit [I] Unit emSize is measured in
139 * **font [I] the resulting Font object
140 *
141 * RETURNS
142 * SUCCESS: Ok
143 * FAILURE: InvalidParameter if fontfamily or font is NULL.
144 * FAILURE: FontFamilyNotFound if an invalid FontFamily is given
145 *
146 * NOTES
147 * UnitDisplay is unsupported.
148 * emSize is stored separately from lfHeight, to hold the fraction.
149 */
151 REAL emSize, INT style, Unit unit, GpFont **font)
152{
153 HFONT hfont;
155 LOGFONTW lfw;
156 HDC hdc;
158 int ret;
159
160 if (!fontFamily || !font || emSize < 0.0)
161 return InvalidParameter;
162
163 TRACE("%p (%s), %f, %d, %d, %p\n", fontFamily,
164 debugstr_w(fontFamily->FamilyName), emSize, style, unit, font);
165
166 memset(&lfw, 0, sizeof(lfw));
167
168 stat = GdipGetFamilyName(fontFamily, lfw.lfFaceName, LANG_NEUTRAL);
169 if (stat != Ok) return stat;
170
171 lfw.lfHeight = -units_to_pixels(emSize, unit, fontFamily->dpi, FALSE);
177
181 otm.otmSize = sizeof(otm);
183 DeleteDC(hdc);
185
186 if (!ret) return NotTrueTypeFont;
187
188 *font = calloc(1, sizeof(GpFont));
189 if (!*font) return OutOfMemory;
190
191 (*font)->unit = unit;
192 (*font)->emSize = emSize;
193 (*font)->otm = otm;
194 GdipCloneFontFamily((GpFontFamily*)fontFamily, &(*font)->family);
195
196 TRACE("<-- %p\n", *font);
197
198 return Ok;
199}
200
201/*******************************************************************************
202 * GdipCreateFontFromLogfontW [GDIPLUS.@]
203 */
205 GDIPCONST LOGFONTW *logfont, GpFont **font)
206{
207 HFONT hfont, oldfont;
209 WCHAR facename[LF_FACESIZE];
211 int ret;
212
213 TRACE("(%p, %p, %p)\n", hdc, logfont, font);
214
215 if (!hdc || !logfont || !font)
216 return InvalidParameter;
217
218 hfont = CreateFontIndirectW(logfont);
219 oldfont = SelectObject(hdc, hfont);
220 otm.otmSize = sizeof(otm);
222 GetTextFaceW(hdc, LF_FACESIZE, facename);
223 SelectObject(hdc, oldfont);
225
226 if (!ret) return NotTrueTypeFont;
227
228 *font = calloc(1, sizeof(GpFont));
229 if (!*font) return OutOfMemory;
230
231 (*font)->unit = UnitWorld;
232 (*font)->emSize = otm.otmTextMetrics.tmHeight - otm.otmTextMetrics.tmInternalLeading;
233 (*font)->otm = otm;
234
235 stat = GdipCreateFontFamilyFromName(facename, NULL, &(*font)->family);
236 if (stat != Ok)
237 {
238 free(*font);
239 *font = NULL;
240 return NotTrueTypeFont;
241 }
242
243 TRACE("<-- %p\n", *font);
244
245 return Ok;
246}
247
248/*******************************************************************************
249 * GdipCreateFontFromLogfontA [GDIPLUS.@]
250 */
253{
254 LOGFONTW lfw;
255
256 TRACE("(%p, %p, %p)\n", hdc, lfa, font);
257
258 if(!lfa || !font)
259 return InvalidParameter;
260
261 memcpy(&lfw, lfa, FIELD_OFFSET(LOGFONTA,lfFaceName) );
262
263 if(!MultiByteToWideChar(CP_ACP, 0, lfa->lfFaceName, -1, lfw.lfFaceName, LF_FACESIZE))
264 return GenericError;
265
266 return GdipCreateFontFromLogfontW(hdc, &lfw, font);
267}
268
269/*******************************************************************************
270 * GdipDeleteFont [GDIPLUS.@]
271 */
273{
274 TRACE("(%p)\n", font);
275
276 if(!font)
277 return InvalidParameter;
278
279 GdipDeleteFontFamily(font->family);
280 free(font);
281
282 return Ok;
283}
284
285/*******************************************************************************
286 * GdipCreateFontFromDC [GDIPLUS.@]
287 */
289{
290 HFONT hfont;
291 LOGFONTW lfw;
292
293 TRACE("(%p, %p)\n", hdc, font);
294
295 if(!font)
296 return InvalidParameter;
297
299 if(!hfont)
300 return GenericError;
301
302 if(!GetObjectW(hfont, sizeof(LOGFONTW), &lfw))
303 return GenericError;
304
305 return GdipCreateFontFromLogfontW(hdc, &lfw, font);
306}
307
308/*******************************************************************************
309 * GdipGetFamily [GDIPLUS.@]
310 *
311 * Returns the FontFamily for the specified Font
312 *
313 * PARAMS
314 * font [I] Font to request from
315 * family [O] Resulting FontFamily object
316 *
317 * RETURNS
318 * SUCCESS: Ok
319 * FAILURE: An element of GpStatus
320 */
322{
323 TRACE("%p %p\n", font, family);
324
325 if (!(font && family))
326 return InvalidParameter;
327
328 return GdipCloneFontFamily(font->family, family);
329}
330
332{
333 return font->emSize;
334}
335
336/******************************************************************************
337 * GdipGetFontSize [GDIPLUS.@]
338 *
339 * Returns the size of the font in Units
340 *
341 * PARAMS
342 * *font [I] The font to retrieve size from
343 * *size [O] Pointer to hold retrieved value
344 *
345 * RETURNS
346 * SUCCESS: Ok
347 * FAILURE: InvalidParameter (font or size was NULL)
348 *
349 * NOTES
350 * Size returned is actually emSize -- not internal size used for drawing.
351 */
353{
354 TRACE("(%p, %p)\n", font, size);
355
356 if (!(font && size)) return InvalidParameter;
357
359 TRACE("%s,%ld => %f\n", debugstr_w(font->family->FamilyName), font->otm.otmTextMetrics.tmHeight, *size);
360
361 return Ok;
362}
363
365{
366 INT style;
367
368 if (font->otm.otmTextMetrics.tmWeight > FW_REGULAR)
370 else
372 if (font->otm.otmTextMetrics.tmItalic)
374 if (font->otm.otmTextMetrics.tmUnderlined)
376 if (font->otm.otmTextMetrics.tmStruckOut)
378
379 return style;
380}
381
382/*******************************************************************************
383 * GdipGetFontStyle [GDIPLUS.@]
384 *
385 * Gets the font's style, returned in bitwise OR of FontStyle enumeration
386 *
387 * PARAMS
388 * font [I] font to request from
389 * style [O] resulting pointer to a FontStyle enumeration
390 *
391 * RETURNS
392 * SUCCESS: Ok
393 * FAILURE: InvalidParameter
394 */
396{
397 TRACE("%p %p\n", font, style);
398
399 if (!(font && style))
400 return InvalidParameter;
401
403 TRACE("%s,%ld => %d\n", debugstr_w(font->family->FamilyName), font->otm.otmTextMetrics.tmHeight, *style);
404
405 return Ok;
406}
407
408/*******************************************************************************
409 * GdipGetFontUnit [GDIPLUS.@]
410 *
411 * PARAMS
412 * font [I] Font to retrieve from
413 * unit [O] Return value
414 *
415 * RETURNS
416 * FAILURE: font or unit was NULL
417 * OK: otherwise
418 */
420{
421 TRACE("(%p, %p)\n", font, unit);
422
423 if (!(font && unit)) return InvalidParameter;
424
425 *unit = font->unit;
426 TRACE("%s,%ld => %d\n", debugstr_w(font->family->FamilyName), font->otm.otmTextMetrics.tmHeight, *unit);
427
428 return Ok;
429}
430
431/*******************************************************************************
432 * GdipGetLogFontA [GDIPLUS.@]
433 */
435 LOGFONTA *lfa)
436{
438 LOGFONTW lfw;
439
440 TRACE("(%p, %p, %p)\n", font, graphics, lfa);
441
442 status = GdipGetLogFontW(font, graphics, &lfw);
443 if(status != Ok)
444 return status;
445
446 memcpy(lfa, &lfw, FIELD_OFFSET(LOGFONTA,lfFaceName) );
447
449 return GenericError;
450
451 return Ok;
452}
453
454/*******************************************************************************
455 * GdipGetLogFontW [GDIPLUS.@]
456 */
458{
459 REAL angle, rel_height, height;
461
462 TRACE("(%p, %p, %p)\n", font, graphics, lf);
463
464 if (!font || !graphics || !lf)
465 return InvalidParameter;
466
467 matrix = graphics->worldtrans;
468
469 if (font->unit == UnitPixel || font->unit == UnitWorld)
470 {
471 height = units_to_pixels(font->emSize, graphics->unit, graphics->yres, graphics->printer_display);
472 if (graphics->unit != UnitDisplay)
473 GdipScaleMatrix(&matrix, graphics->scale, graphics->scale, MatrixOrderAppend);
474 }
475 else
476 {
477 if (graphics->unit == UnitDisplay || graphics->unit == UnitPixel)
478 height = units_to_pixels(font->emSize, font->unit, graphics->xres, graphics->printer_display);
479 else
480 height = units_to_pixels(font->emSize, font->unit, graphics->yres, graphics->printer_display);
481 }
482
484 transform_properties(graphics, &matrix, FALSE, NULL, &rel_height, &angle);
485 get_log_fontW(font, graphics, lf);
486
487 lf->lfHeight = -gdip_round(height * rel_height);
488 lf->lfEscapement = lf->lfOrientation = gdip_round((angle / M_PI) * 1800.0);
489 if (lf->lfEscapement < 0)
490 {
491 lf->lfEscapement += 3600;
492 lf->lfOrientation += 3600;
493 }
494
495 TRACE("=> %s,%ld\n", debugstr_w(lf->lfFaceName), lf->lfHeight);
496
497 return Ok;
498}
499
500/*******************************************************************************
501 * GdipCloneFont [GDIPLUS.@]
502 */
504{
505 TRACE("(%p, %p)\n", font, cloneFont);
506
507 if(!font || !cloneFont)
508 return InvalidParameter;
509
510 *cloneFont = calloc(1, sizeof(GpFont));
511 if(!*cloneFont) return OutOfMemory;
512
513 **cloneFont = *font;
514 return Ok;
515}
516
517/*******************************************************************************
518 * GdipGetFontHeight [GDIPLUS.@]
519 * PARAMS
520 * font [I] Font to retrieve height from
521 * graphics [I] The current graphics context
522 * height [O] Resulting height
523 * RETURNS
524 * SUCCESS: Ok
525 * FAILURE: Another element of GpStatus
526 *
527 * NOTES
528 * Forwards to GdipGetFontHeightGivenDPI
529 */
531 GDIPCONST GpGraphics *graphics, REAL *height)
532{
533 REAL dpi;
535 REAL font_height;
536
537 TRACE("%p %p %p\n", font, graphics, height);
538
539 if (!font || !height) return InvalidParameter;
540
541 stat = GdipGetFontHeightGivenDPI(font, font->family->dpi, &font_height);
542 if (stat != Ok) return stat;
543
544 if (!graphics)
545 {
546 *height = font_height;
547 TRACE("%s,%ld => %f\n",
548 debugstr_w(font->family->FamilyName), font->otm.otmTextMetrics.tmHeight, *height);
549 return Ok;
550 }
551
552 stat = GdipGetDpiY((GpGraphics *)graphics, &dpi);
553 if (stat != Ok) return stat;
554
555 *height = pixels_to_units(font_height, graphics->unit, dpi, graphics->printer_display);
556
557 TRACE("%s,%ld(unit %d) => %f\n",
558 debugstr_w(font->family->FamilyName), font->otm.otmTextMetrics.tmHeight, graphics->unit, *height);
559 return Ok;
560}
561
562/*******************************************************************************
563 * GdipGetFontHeightGivenDPI [GDIPLUS.@]
564 * PARAMS
565 * font [I] Font to retrieve DPI from
566 * dpi [I] DPI to assume
567 * height [O] Return value
568 *
569 * RETURNS
570 * SUCCESS: Ok
571 * FAILURE: InvalidParameter if font or height is NULL
572 *
573 * NOTES
574 * According to MSDN, the result is (lineSpacing)*(fontSize / emHeight)*dpi
575 * (for anything other than unit Pixel)
576 */
578{
580 INT style;
581 UINT16 line_spacing, em_height;
582 REAL font_size;
583
584 if (!font || !height) return InvalidParameter;
585
586 TRACE("%p (%s), %f, %p\n", font,
587 debugstr_w(font->family->FamilyName), dpi, height);
588
589 font_size = units_to_pixels(get_font_size(font), font->unit, dpi, FALSE);
591 stat = GdipGetLineSpacing(font->family, style, &line_spacing);
592 if (stat != Ok) return stat;
593 stat = GdipGetEmHeight(font->family, style, &em_height);
594 if (stat != Ok) return stat;
595
596 *height = (REAL)line_spacing * font_size / (REAL)em_height;
597
598 TRACE("%s,%ld => %f\n",
599 debugstr_w(font->family->FamilyName), font->otm.otmTextMetrics.tmHeight, *height);
600
601 return Ok;
602}
603
604/***********************************************************************
605 * Borrowed from GDI32:
606 *
607 * Elf is really an ENUMLOGFONTEXW, and ntm is a NEWTEXTMETRICEXW.
608 * We have to use other types because of the FONTENUMPROCW definition.
609 */
611 const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
612{
613 const ENUMLOGFONTW *elfW = (const ENUMLOGFONTW *)elf;
614 LOGFONTW *lf = (LOGFONTW *)lParam;
615
616 if (type & RASTER_FONTTYPE)
617 return 1;
618
619 *lf = *elf;
620 /* replace substituted font name by a real one */
622 return 0;
623}
624
626{
629 int dpi;
630};
631
633{
635 TT_OS2_V2 tt_os2;
636 TT_HHEA tt_hori;
637 LONG size;
638 UINT16 line_gap;
639
640 otm.otmSize = sizeof(otm);
641 if (!GetOutlineTextMetricsW(hdc, otm.otmSize, &otm)) return FALSE;
642
643 fm->em_height = otm.otmEMSquare;
645
646 memset(&tt_hori, 0, sizeof(tt_hori));
647 if (GetFontData(hdc, MS_HHEA_TAG, 0, &tt_hori, sizeof(tt_hori)) != GDI_ERROR)
648 {
649 fm->ascent = GET_BE_WORD(tt_hori.Ascender);
650 fm->descent = -GET_BE_WORD(tt_hori.Descender);
651 TRACE("hhea: ascent %d, descent %d\n", fm->ascent, fm->descent);
652 line_gap = GET_BE_WORD(tt_hori.LineGap);
653 fm->line_spacing = fm->ascent + fm->descent + line_gap;
654 TRACE("line_gap %u, line_spacing %u\n", line_gap, fm->line_spacing);
655 if (fm->ascent + fm->descent != 0) return TRUE;
656 }
657
659 if (size == GDI_ERROR) return FALSE;
660
661 if (size > sizeof(tt_os2)) size = sizeof(tt_os2);
662
663 memset(&tt_os2, 0, sizeof(tt_os2));
664 if (GetFontData(hdc, MS_OS2_TAG, 0, &tt_os2, size) != size) return FALSE;
665
666 fm->ascent = GET_BE_WORD(tt_os2.usWinAscent);
667 fm->descent = GET_BE_WORD(tt_os2.usWinDescent);
668 TRACE("usWinAscent %u, usWinDescent %u\n", fm->ascent, fm->descent);
669 if (fm->ascent + fm->descent == 0)
670 {
671 fm->ascent = GET_BE_WORD(tt_os2.sTypoAscender);
672 fm->descent = GET_BE_WORD(tt_os2.sTypoDescender);
673 TRACE("sTypoAscender %u, sTypoDescender %u\n", fm->ascent, fm->descent);
674 }
675 line_gap = GET_BE_WORD(tt_os2.sTypoLineGap);
676 fm->line_spacing = fm->ascent + fm->descent + line_gap;
677 TRACE("line_gap %u, line_spacing %u\n", line_gap, fm->line_spacing);
678 return TRUE;
679}
680
681/*******************************************************************************
682 * GdipCreateFontFamilyFromName [GDIPLUS.@]
683 *
684 * Creates a font family object based on a supplied name
685 *
686 * PARAMS
687 * name [I] Name of the font
688 * fontCollection [I] What font collection (if any) the font belongs to (may be NULL)
689 * FontFamily [O] Pointer to the resulting FontFamily object
690 *
691 * RETURNS
692 * SUCCESS: Ok
693 * FAILURE: FamilyNotFound if the requested FontFamily does not exist on the system
694 * FAILURE: Invalid parameter if FontFamily or name is NULL
695 *
696 * NOTES
697 * If fontCollection is NULL then the object is not part of any collection
698 *
699 */
700
703 GpFontFamily **family)
704{
705 HDC hdc;
706 LOGFONTW lf;
708 int i;
709
710 TRACE("%s, %p %p\n", debugstr_w(name), collection, family);
711
712 if (!name || !family)
713 return InvalidParameter;
714
715 if (!collection)
716 {
718 if (status != Ok) return status;
719 }
720
722
724
726 {
727 for (i = 0; i < collection->count; i++)
728 {
729 if (!wcsicmp(lf.lfFaceName, collection->FontFamilies[i]->FamilyName))
730 {
731 status = GdipCloneFontFamily(collection->FontFamilies[i], family);
732 TRACE("<-- %p\n", *family);
733 break;
734 }
735 }
736 }
737
738 DeleteDC(hdc);
739 return status;
740}
741
742/*******************************************************************************
743 * GdipCloneFontFamily [GDIPLUS.@]
744 *
745 * Creates a deep copy of a Font Family object
746 *
747 * PARAMS
748 * FontFamily [I] Font to clone
749 * clonedFontFamily [O] The resulting cloned font
750 *
751 * RETURNS
752 * SUCCESS: Ok
753 */
755{
756 if (!family || !clone)
757 return InvalidParameter;
758
759 TRACE("%p (%s), %p\n", family, debugstr_w(family->FamilyName), clone);
760
761 *clone = family;
762
763 if (!family->installed)
764 InterlockedIncrement(&family->ref);
765
766 return Ok;
767}
768
769/*******************************************************************************
770 * GdipGetFamilyName [GDIPLUS.@]
771 *
772 * Returns the family name into name
773 *
774 * PARAMS
775 * *family [I] Family to retrieve from
776 * *name [O] WCHARS of the family name
777 * LANGID [I] charset
778 *
779 * RETURNS
780 * SUCCESS: Ok
781 * FAILURE: InvalidParameter if family is NULL
782 *
783 * NOTES
784 * If name is NULL, XP and Vista crash but not Windows 7+
785 */
787 WCHAR *name, LANGID language)
788{
789 static int lang_fixme;
790
791 TRACE("%p, %p, %d\n", family, name, language);
792
793 if (family == NULL)
794 return InvalidParameter;
795
796 if (name == NULL)
797 return Ok;
798
799 if (language != LANG_NEUTRAL && !lang_fixme++)
800 FIXME("No support for handling of multiple languages!\n");
801
802 lstrcpynW (name, family->FamilyName, LF_FACESIZE);
803
804 return Ok;
805}
806
807
808/*****************************************************************************
809 * GdipDeleteFontFamily [GDIPLUS.@]
810 *
811 * Removes the specified FontFamily
812 *
813 * PARAMS
814 * *FontFamily [I] The family to delete
815 *
816 * RETURNS
817 * SUCCESS: Ok
818 * FAILURE: InvalidParameter if FontFamily is NULL.
819 *
820 */
822{
823 if (!FontFamily)
824 return InvalidParameter;
825
826 if (!FontFamily->installed && !InterlockedDecrement(&FontFamily->ref))
827 {
829 }
830
831 return Ok;
832}
833
835 INT style, UINT16* CellAscent)
836{
837 if (!(family && CellAscent)) return InvalidParameter;
838
839 *CellAscent = family->ascent;
840 TRACE("%s => %u\n", debugstr_w(family->FamilyName), *CellAscent);
841
842 return Ok;
843}
844
846 INT style, UINT16* CellDescent)
847{
848 TRACE("(%p, %d, %p)\n", family, style, CellDescent);
849
850 if (!(family && CellDescent)) return InvalidParameter;
851
852 *CellDescent = family->descent;
853 TRACE("%s => %u\n", debugstr_w(family->FamilyName), *CellDescent);
854
855 return Ok;
856}
857
858/*******************************************************************************
859 * GdipGetEmHeight [GDIPLUS.@]
860 *
861 * Gets the height of the specified family in EmHeights
862 *
863 * PARAMS
864 * family [I] Family to retrieve from
865 * style [I] (optional) style
866 * EmHeight [O] return value
867 *
868 * RETURNS
869 * SUCCESS: Ok
870 * FAILURE: InvalidParameter
871 */
873{
874 if (!(family && EmHeight)) return InvalidParameter;
875
876 TRACE("%p (%s), %d, %p\n", family, debugstr_w(family->FamilyName), style, EmHeight);
877
878 *EmHeight = family->em_height;
879 TRACE("%s => %u\n", debugstr_w(family->FamilyName), *EmHeight);
880
881 return Ok;
882}
883
884
885/*******************************************************************************
886 * GdipGetLineSpacing [GDIPLUS.@]
887 *
888 * Returns the line spacing in design units
889 *
890 * PARAMS
891 * family [I] Family to retrieve from
892 * style [I] (Optional) font style
893 * LineSpacing [O] Return value
894 *
895 * RETURNS
896 * SUCCESS: Ok
897 * FAILURE: InvalidParameter (family or LineSpacing was NULL)
898 */
900 INT style, UINT16* LineSpacing)
901{
902 TRACE("%p, %d, %p\n", family, style, LineSpacing);
903
904 if (!(family && LineSpacing))
905 return InvalidParameter;
906
907 if (style) FIXME("ignoring style\n");
908
909 *LineSpacing = family->line_spacing;
910 TRACE("%s => %u\n", debugstr_w(family->FamilyName), *LineSpacing);
911
912 return Ok;
913}
914
916 const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
917{
918 INT fontstyle = FontStyleRegular;
919
920 if (!ntm) return 1;
921
922 if (ntm->tmWeight >= FW_BOLD) fontstyle |= FontStyleBold;
923 if (ntm->tmItalic) fontstyle |= FontStyleItalic;
924 if (ntm->tmUnderlined) fontstyle |= FontStyleUnderline;
925 if (ntm->tmStruckOut) fontstyle |= FontStyleStrikeout;
926
927 return (INT)lParam != fontstyle;
928}
929
931 INT style, BOOL* IsStyleAvailable)
932{
933 HDC hdc;
934
935 TRACE("%p %d %p\n", family, style, IsStyleAvailable);
936
937 if (!(family && IsStyleAvailable))
938 return InvalidParameter;
939
940 *IsStyleAvailable = FALSE;
941
943
944 if(!EnumFontFamiliesW(hdc, family->FamilyName, font_has_style_proc, (LPARAM)style))
945 *IsStyleAvailable = TRUE;
946
947 DeleteDC(hdc);
948
949 return Ok;
950}
951
952/*****************************************************************************
953 * GdipGetGenericFontFamilyMonospace [GDIPLUS.@]
954 *
955 * Obtains a monospace family (Courier New on Windows)
956 *
957 * PARAMS
958 * **nativeFamily [O] Where the font will be stored
959 *
960 * RETURNS
961 * InvalidParameter if nativeFamily is NULL.
962 * FontFamilyNotFound if unable to get font.
963 * Ok otherwise.
964 */
966{
968
969 TRACE("(%p)\n", nativeFamily);
970
971 if (nativeFamily == NULL) return InvalidParameter;
972
973 stat = GdipCreateFontFamilyFromName(L"Courier New", NULL, nativeFamily);
974
976 stat = GdipCreateFontFamilyFromName(L"Liberation Mono", NULL, nativeFamily);
977
979 stat = GdipCreateFontFamilyFromName(L"Courier", NULL, nativeFamily);
980
981 return stat;
982}
983
984/*****************************************************************************
985 * GdipGetGenericFontFamilySerif [GDIPLUS.@]
986 *
987 * Obtains a serif family (Times New Roman on Windows)
988 *
989 * PARAMS
990 * **nativeFamily [O] Where the font will be stored
991 *
992 * RETURNS
993 * InvalidParameter if nativeFamily is NULL.
994 * FontFamilyNotFound if unable to get font.
995 * Ok otherwise.
996 */
998{
1000
1001 TRACE("(%p)\n", nativeFamily);
1002
1003 if (nativeFamily == NULL) return InvalidParameter;
1004
1005 stat = GdipCreateFontFamilyFromName(L"Times New Roman", NULL, nativeFamily);
1006
1007 if (stat == FontFamilyNotFound)
1008 stat = GdipCreateFontFamilyFromName(L"Liberation Serif", NULL, nativeFamily);
1009
1010 if (stat == FontFamilyNotFound)
1012
1013 return stat;
1014}
1015
1016/*****************************************************************************
1017 * GdipGetGenericFontFamilySansSerif [GDIPLUS.@]
1018 *
1019 * Obtains a sans serif family (Microsoft Sans Serif or Arial on Windows)
1020 *
1021 * PARAMS
1022 * **nativeFamily [O] Where the font will be stored
1023 *
1024 * RETURNS
1025 * InvalidParameter if nativeFamily is NULL.
1026 * FontFamilyNotFound if unable to get font.
1027 * Ok otherwise.
1028 */
1030{
1031 GpStatus stat;
1032
1033 TRACE("(%p)\n", nativeFamily);
1034
1035 if (nativeFamily == NULL) return InvalidParameter;
1036
1037 stat = GdipCreateFontFamilyFromName(L"Microsoft Sans Serif", NULL, nativeFamily);
1038
1039 if (stat == FontFamilyNotFound)
1040 stat = GdipCreateFontFamilyFromName(L"Tahoma", NULL, nativeFamily);
1041
1042 if (stat == FontFamilyNotFound)
1043 stat = GdipCreateFontFamilyFromName(L"Arial", NULL, nativeFamily);
1044
1045 if (stat == FontFamilyNotFound)
1046 stat = GdipCreateFontFamilyFromName(L"Liberation Sans", NULL, nativeFamily);
1047
1048 return stat;
1049}
1050
1051/*****************************************************************************
1052 * GdipNewPrivateFontCollection [GDIPLUS.@]
1053 */
1055{
1056 TRACE("%p\n", fontCollection);
1057
1058 if (!fontCollection)
1059 return InvalidParameter;
1060
1061 *fontCollection = calloc(1, sizeof(GpFontCollection));
1062 if (!*fontCollection) return OutOfMemory;
1063
1064 (*fontCollection)->FontFamilies = NULL;
1065 (*fontCollection)->count = 0;
1066 (*fontCollection)->allocated = 0;
1067
1068 TRACE("<-- %p\n", *fontCollection);
1069
1070 return Ok;
1071}
1072
1073/*****************************************************************************
1074 * GdipDeletePrivateFontCollection [GDIPLUS.@]
1075 */
1077{
1078 INT i;
1079
1080 TRACE("%p\n", fontCollection);
1081
1082 if (!fontCollection)
1083 return InvalidParameter;
1084
1085 for (i = 0; i < (*fontCollection)->count; i++) GdipDeleteFontFamily((*fontCollection)->FontFamilies[i]);
1086 free((*fontCollection)->FontFamilies);
1087 free(*fontCollection);
1088
1089 return Ok;
1090}
1091
1092/*****************************************************************************
1093 * GdipPrivateAddFontFile [GDIPLUS.@]
1094 */
1096{
1099 void *mem;
1101
1102 TRACE("%p, %s\n", collection, debugstr_w(name));
1103
1104 if (!collection || !name) return InvalidParameter;
1105
1108
1109 if (!GetFileSizeEx(file, &size) || size.u.HighPart)
1110 {
1112 return InvalidParameter;
1113 }
1114
1117 if (!mapping) return InvalidParameter;
1118
1121 if (!mem) return InvalidParameter;
1122
1123 /* GdipPrivateAddMemoryFont creates a copy of the memory block */
1126
1127 return status;
1128}
1129
1130#define TT_PLATFORM_APPLE_UNICODE 0
1131#define TT_PLATFORM_MACINTOSH 1
1132#define TT_PLATFORM_MICROSOFT 3
1133
1134#define TT_APPLE_ID_DEFAULT 0
1135#define TT_APPLE_ID_ISO_10646 2
1136#define TT_APPLE_ID_UNICODE_2_0 3
1137
1138#define TT_MS_ID_SYMBOL_CS 0
1139#define TT_MS_ID_UNICODE_CS 1
1140
1141#define TT_MAC_ID_SIMPLIFIED_CHINESE 25
1142
1143#define NAME_ID_FULL_FONT_NAME 4
1144
1145typedef struct {
1151} tt_header;
1152
1153#define TT_HEADER_VERSION_1 0x00010000
1154#define TT_HEADER_VERSION_CFF 0x4f54544f
1155
1156typedef struct {
1157 char tag[4]; /* table name */
1158 ULONG check_sum; /* Check sum */
1159 ULONG offset; /* Offset from beginning of file */
1160 ULONG length; /* length of the table in bytes */
1162
1163typedef struct {
1164 USHORT format; /* format selector. Always 0 */
1165 USHORT count; /* Name Records count */
1166 USHORT string_offset; /* Offset for strings storage, * from start of the table */
1168
1169typedef struct {
1175 USHORT offset; /* from start of storage area */
1177
1178/* Copied from gdi32/freetype.c */
1179
1180static const LANGID mac_langid_table[] =
1181{
1182 MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ENGLISH */
1183 MAKELANGID(LANG_FRENCH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_FRENCH */
1184 MAKELANGID(LANG_GERMAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_GERMAN */
1185 MAKELANGID(LANG_ITALIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ITALIAN */
1186 MAKELANGID(LANG_DUTCH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_DUTCH */
1187 MAKELANGID(LANG_SWEDISH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SWEDISH */
1188 MAKELANGID(LANG_SPANISH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SPANISH */
1189 MAKELANGID(LANG_DANISH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_DANISH */
1190 MAKELANGID(LANG_PORTUGUESE,SUBLANG_DEFAULT), /* TT_MAC_LANGID_PORTUGUESE */
1191 MAKELANGID(LANG_NORWEGIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_NORWEGIAN */
1192 MAKELANGID(LANG_HEBREW,SUBLANG_DEFAULT), /* TT_MAC_LANGID_HEBREW */
1193 MAKELANGID(LANG_JAPANESE,SUBLANG_DEFAULT), /* TT_MAC_LANGID_JAPANESE */
1194 MAKELANGID(LANG_ARABIC,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ARABIC */
1195 MAKELANGID(LANG_FINNISH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_FINNISH */
1196 MAKELANGID(LANG_GREEK,SUBLANG_DEFAULT), /* TT_MAC_LANGID_GREEK */
1197 MAKELANGID(LANG_ICELANDIC,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ICELANDIC */
1198 MAKELANGID(LANG_MALTESE,SUBLANG_DEFAULT), /* TT_MAC_LANGID_MALTESE */
1199 MAKELANGID(LANG_TURKISH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_TURKISH */
1200 MAKELANGID(LANG_CROATIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_CROATIAN */
1201 MAKELANGID(LANG_CHINESE_TRADITIONAL,SUBLANG_DEFAULT), /* TT_MAC_LANGID_CHINESE_TRADITIONAL */
1202 MAKELANGID(LANG_URDU,SUBLANG_DEFAULT), /* TT_MAC_LANGID_URDU */
1203 MAKELANGID(LANG_HINDI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_HINDI */
1204 MAKELANGID(LANG_THAI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_THAI */
1205 MAKELANGID(LANG_KOREAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_KOREAN */
1206 MAKELANGID(LANG_LITHUANIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_LITHUANIAN */
1207 MAKELANGID(LANG_POLISH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_POLISH */
1208 MAKELANGID(LANG_HUNGARIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_HUNGARIAN */
1209 MAKELANGID(LANG_ESTONIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ESTONIAN */
1210 MAKELANGID(LANG_LATVIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_LETTISH */
1211 MAKELANGID(LANG_SAMI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SAAMISK */
1212 MAKELANGID(LANG_FAEROESE,SUBLANG_DEFAULT), /* TT_MAC_LANGID_FAEROESE */
1213 MAKELANGID(LANG_FARSI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_FARSI */
1214 MAKELANGID(LANG_RUSSIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_RUSSIAN */
1215 MAKELANGID(LANG_CHINESE_SIMPLIFIED,SUBLANG_DEFAULT), /* TT_MAC_LANGID_CHINESE_SIMPLIFIED */
1216 MAKELANGID(LANG_DUTCH,SUBLANG_DUTCH_BELGIAN), /* TT_MAC_LANGID_FLEMISH */
1217 MAKELANGID(LANG_IRISH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_IRISH */
1218 MAKELANGID(LANG_ALBANIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ALBANIAN */
1219 MAKELANGID(LANG_ROMANIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ROMANIAN */
1220 MAKELANGID(LANG_CZECH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_CZECH */
1221 MAKELANGID(LANG_SLOVAK,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SLOVAK */
1222 MAKELANGID(LANG_SLOVENIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SLOVENIAN */
1223 0, /* TT_MAC_LANGID_YIDDISH */
1224 MAKELANGID(LANG_SERBIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SERBIAN */
1225 MAKELANGID(LANG_MACEDONIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_MACEDONIAN */
1226 MAKELANGID(LANG_BULGARIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_BULGARIAN */
1227 MAKELANGID(LANG_UKRAINIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_UKRAINIAN */
1228 MAKELANGID(LANG_BELARUSIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_BYELORUSSIAN */
1229 MAKELANGID(LANG_UZBEK,SUBLANG_DEFAULT), /* TT_MAC_LANGID_UZBEK */
1230 MAKELANGID(LANG_KAZAK,SUBLANG_DEFAULT), /* TT_MAC_LANGID_KAZAKH */
1231 MAKELANGID(LANG_AZERI,SUBLANG_AZERI_CYRILLIC), /* TT_MAC_LANGID_AZERBAIJANI */
1232 0, /* TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT */
1233 MAKELANGID(LANG_ARMENIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ARMENIAN */
1234 MAKELANGID(LANG_GEORGIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_GEORGIAN */
1235 0, /* TT_MAC_LANGID_MOLDAVIAN */
1236 MAKELANGID(LANG_KYRGYZ,SUBLANG_DEFAULT), /* TT_MAC_LANGID_KIRGHIZ */
1237 MAKELANGID(LANG_TAJIK,SUBLANG_DEFAULT), /* TT_MAC_LANGID_TAJIKI */
1238 MAKELANGID(LANG_TURKMEN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_TURKMEN */
1239 MAKELANGID(LANG_MONGOLIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_MONGOLIAN */
1240 MAKELANGID(LANG_MONGOLIAN,SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA), /* TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT */
1241 MAKELANGID(LANG_PASHTO,SUBLANG_DEFAULT), /* TT_MAC_LANGID_PASHTO */
1242 0, /* TT_MAC_LANGID_KURDISH */
1243 MAKELANGID(LANG_KASHMIRI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_KASHMIRI */
1244 MAKELANGID(LANG_SINDHI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SINDHI */
1245 MAKELANGID(LANG_TIBETAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_TIBETAN */
1246 MAKELANGID(LANG_NEPALI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_NEPALI */
1247 MAKELANGID(LANG_SANSKRIT,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SANSKRIT */
1248 MAKELANGID(LANG_MARATHI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_MARATHI */
1249 MAKELANGID(LANG_BENGALI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_BENGALI */
1250 MAKELANGID(LANG_ASSAMESE,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ASSAMESE */
1251 MAKELANGID(LANG_GUJARATI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_GUJARATI */
1252 MAKELANGID(LANG_PUNJABI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_PUNJABI */
1253 MAKELANGID(LANG_ORIYA,SUBLANG_DEFAULT), /* TT_MAC_LANGID_ORIYA */
1254 MAKELANGID(LANG_MALAYALAM,SUBLANG_DEFAULT), /* TT_MAC_LANGID_MALAYALAM */
1255 MAKELANGID(LANG_KANNADA,SUBLANG_DEFAULT), /* TT_MAC_LANGID_KANNADA */
1256 MAKELANGID(LANG_TAMIL,SUBLANG_DEFAULT), /* TT_MAC_LANGID_TAMIL */
1257 MAKELANGID(LANG_TELUGU,SUBLANG_DEFAULT), /* TT_MAC_LANGID_TELUGU */
1258 MAKELANGID(LANG_SINHALESE,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SINHALESE */
1259 0, /* TT_MAC_LANGID_BURMESE */
1260 MAKELANGID(LANG_KHMER,SUBLANG_DEFAULT), /* TT_MAC_LANGID_KHMER */
1261 MAKELANGID(LANG_LAO,SUBLANG_DEFAULT), /* TT_MAC_LANGID_LAO */
1262 MAKELANGID(LANG_VIETNAMESE,SUBLANG_DEFAULT), /* TT_MAC_LANGID_VIETNAMESE */
1263 MAKELANGID(LANG_INDONESIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_INDONESIAN */
1264 0, /* TT_MAC_LANGID_TAGALOG */
1265 MAKELANGID(LANG_MALAY,SUBLANG_DEFAULT), /* TT_MAC_LANGID_MALAY_ROMAN_SCRIPT */
1266 0, /* TT_MAC_LANGID_MALAY_ARABIC_SCRIPT */
1267 MAKELANGID(LANG_AMHARIC,SUBLANG_DEFAULT), /* TT_MAC_LANGID_AMHARIC */
1268 MAKELANGID(LANG_TIGRIGNA,SUBLANG_DEFAULT), /* TT_MAC_LANGID_TIGRINYA */
1269 0, /* TT_MAC_LANGID_GALLA */
1270 0, /* TT_MAC_LANGID_SOMALI */
1271 MAKELANGID(LANG_SWAHILI,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SWAHILI */
1272 0, /* TT_MAC_LANGID_RUANDA */
1273 0, /* TT_MAC_LANGID_RUNDI */
1274 0, /* TT_MAC_LANGID_CHEWA */
1275 0, /* TT_MAC_LANGID_MALAGASY */
1276 0, /* TT_MAC_LANGID_ESPERANTO */
1277 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 95-111 */
1278 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112-127 */
1279 MAKELANGID(LANG_WELSH,SUBLANG_DEFAULT), /* TT_MAC_LANGID_WELSH */
1280 MAKELANGID(LANG_BASQUE,SUBLANG_DEFAULT), /* TT_MAC_LANGID_BASQUE */
1281 MAKELANGID(LANG_CATALAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_CATALAN */
1282 0, /* TT_MAC_LANGID_LATIN */
1283 MAKELANGID(LANG_QUECHUA,SUBLANG_DEFAULT), /* TT_MAC_LANGID_QUECHUA */
1284 0, /* TT_MAC_LANGID_GUARANI */
1285 0, /* TT_MAC_LANGID_AYMARA */
1286 MAKELANGID(LANG_TATAR,SUBLANG_DEFAULT), /* TT_MAC_LANGID_TATAR */
1287 MAKELANGID(LANG_UIGHUR,SUBLANG_DEFAULT), /* TT_MAC_LANGID_UIGHUR */
1288 0, /* TT_MAC_LANGID_DZONGKHA */
1289 0, /* TT_MAC_LANGID_JAVANESE */
1290 0, /* TT_MAC_LANGID_SUNDANESE */
1291 MAKELANGID(LANG_GALICIAN,SUBLANG_DEFAULT), /* TT_MAC_LANGID_GALICIAN */
1292 MAKELANGID(LANG_AFRIKAANS,SUBLANG_DEFAULT), /* TT_MAC_LANGID_AFRIKAANS */
1293 MAKELANGID(LANG_BRETON,SUBLANG_DEFAULT), /* TT_MAC_LANGID_BRETON */
1294 MAKELANGID(LANG_INUKTITUT,SUBLANG_DEFAULT), /* TT_MAC_LANGID_INUKTITUT */
1295 MAKELANGID(LANG_SCOTTISH_GAELIC,SUBLANG_DEFAULT), /* TT_MAC_LANGID_SCOTTISH_GAELIC */
1296 0, /* TT_MAC_LANGID_MANX_GAELIC */
1297 MAKELANGID(LANG_IRISH,SUBLANG_IRISH_IRELAND), /* TT_MAC_LANGID_IRISH_GAELIC */
1298 0, /* TT_MAC_LANGID_TONGAN */
1299 0, /* TT_MAC_LANGID_GREEK_POLYTONIC */
1300 MAKELANGID(LANG_GREENLANDIC,SUBLANG_DEFAULT), /* TT_MAC_LANGID_GREELANDIC */
1301 MAKELANGID(LANG_AZERI,SUBLANG_AZERI_LATIN), /* TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT */
1302};
1303
1305{
1306 WORD encoding_id = GET_BE_WORD(name->encoding_id);
1307 if (encoding_id == TT_MAC_ID_SIMPLIFIED_CHINESE) return 10008; /* special case */
1308 return 10000 + encoding_id;
1309}
1310
1312{
1313 LANGID name_lang;
1314
1315 switch (GET_BE_WORD(name->platform_id))
1316 {
1318 switch (GET_BE_WORD(name->encoding_id))
1319 {
1321 case TT_MS_ID_SYMBOL_CS:
1322 name_lang = GET_BE_WORD(name->language_id);
1323 break;
1324 default:
1325 return 0;
1326 }
1327 break;
1329 if (!IsValidCodePage( get_mac_code_page( name ))) return 0;
1330 name_lang = GET_BE_WORD(name->language_id);
1331 if (name_lang >= ARRAY_SIZE(mac_langid_table)) return 0;
1332 name_lang = mac_langid_table[name_lang];
1333 break;
1335 switch (GET_BE_WORD(name->encoding_id))
1336 {
1340 name_lang = GET_BE_WORD(name->language_id);
1341 if (name_lang >= ARRAY_SIZE(mac_langid_table)) return 0;
1342 name_lang = mac_langid_table[name_lang];
1343 break;
1344 default:
1345 return 0;
1346 }
1347 break;
1348 default:
1349 return 0;
1350 }
1351 if (name_lang == lang) return 3;
1352 if (PRIMARYLANGID( name_lang ) == PRIMARYLANGID( lang )) return 2;
1353 if (name_lang == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT )) return 1;
1354 return 0;
1355}
1356
1358{
1359 WORD name_len = GET_BE_WORD(name->length);
1360 WORD codepage;
1361 WCHAR *ret;
1362 int len;
1363
1364 switch (GET_BE_WORD(name->platform_id))
1365 {
1368 ret = malloc((name_len / 2 + 1) * sizeof(WCHAR));
1369 for (len = 0; len < name_len / 2; len++)
1370 ret[len] = (data[len * 2] << 8) | data[len * 2 + 1];
1371 ret[len] = 0;
1372 return ret;
1375 len = MultiByteToWideChar( codepage, 0, (char *)data, name_len, NULL, 0 ) + 1;
1376 if (!len)
1377 return NULL;
1378 ret = malloc(len * sizeof(WCHAR));
1379 len = MultiByteToWideChar( codepage, 0, (char *)data, name_len, ret, len - 1 );
1380 ret[len] = 0;
1381 return ret;
1382 }
1383 return NULL;
1384}
1385
1387{
1388 static const WORD platform_id_table[] = {TT_PLATFORM_MICROSOFT, TT_PLATFORM_MACINTOSH, TT_PLATFORM_APPLE_UNICODE};
1390 const tt_header *header;
1391 const tt_name_table *name_table;
1392 const tt_name_record *name_record_table, *name_record;
1393 DWORD pos, ofs = 0, count;
1394 int i, j, res, best_lang = 0, best_index = -1;
1395
1396 if (sizeof(tt_header) > size)
1397 return NULL;
1398 header = (const tt_header*)mem;
1399 count = GET_BE_WORD(header->tables_no);
1400
1401 if (GET_BE_DWORD(header->version) != TT_HEADER_VERSION_1 &&
1403 return NULL;
1404
1405 pos = sizeof(*header);
1406 for (i = 0; i < count; i++)
1407 {
1409 pos += sizeof(*table_directory);
1410 if (memcmp(table_directory->tag, "name", 4) == 0)
1411 {
1412 ofs = GET_BE_DWORD(table_directory->offset);
1413 break;
1414 }
1415 }
1416 if (i >= count)
1417 return NULL;
1418
1419 if (ofs >= size)
1420 return NULL;
1421 pos = ofs + sizeof(*name_table);
1422 if (pos > size)
1423 return NULL;
1424 name_table = (const tt_name_table*)&mem[ofs];
1425 name_record_table = (const tt_name_record *)&mem[pos];
1426 count = GET_BE_WORD(name_table->count);
1427 if (GET_BE_WORD(name_table->string_offset) >= size - ofs) return NULL;
1428 ofs += GET_BE_WORD(name_table->string_offset);
1429 for (i = 0; i < ARRAY_SIZE(platform_id_table); i++)
1430 {
1431 for (j = 0; j < count; j++)
1432 {
1433 name_record = name_record_table + j;
1434 if ((const BYTE *)name_record - mem > size)
1435 return NULL;
1436
1437 if (GET_BE_WORD(name_record->platform_id) != platform_id_table[i]) continue;
1438 if (GET_BE_WORD(name_record->name_id) != id) continue;
1439 if (GET_BE_WORD(name_record->offset) >= size - ofs) return NULL;
1440 if (GET_BE_WORD(name_record->length) > size - ofs - GET_BE_WORD(name_record->offset)) return NULL;
1441
1443 if (res > best_lang)
1444 {
1445 best_lang = res;
1446 best_index = j;
1447 }
1448 }
1449
1450 if (best_index != -1)
1451 break;
1452 }
1453
1454 if (best_lang)
1455 {
1456 WCHAR *ret;
1457 name_record = (const tt_name_record*)(name_table + 1) + best_index;
1459 TRACE( "name %u found platform %u lang %04x %s\n", GET_BE_WORD(name_record->name_id),
1460 GET_BE_WORD(name_record->platform_id), GET_BE_WORD(name_record->language_id), debugstr_w( ret ));
1461 return ret;
1462 }
1463 return NULL;
1464}
1465
1467{
1472};
1473
1474static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam);
1475
1476/*****************************************************************************
1477 * GdipPrivateAddMemoryFont [GDIPLUS.@]
1478 */
1480 GDIPCONST void* memory, INT length)
1481{
1482 WCHAR *name;
1483 DWORD count = 0;
1484 HANDLE font;
1485 GpStatus ret = Ok;
1486 TRACE("%p, %p, %d\n", fontCollection, memory, length);
1487
1488 if (!fontCollection || !memory || !length)
1489 return InvalidParameter;
1490
1492 if (!name)
1493 return OutOfMemory;
1494
1496 TRACE("%s: %p/%lu\n", debugstr_w(name), font, count);
1497 if (!font || !count)
1499 else
1500 {
1501 struct add_font_param param;
1502 LOGFONTW lfw;
1503
1504 param.hdc = CreateCompatibleDC(0);
1505
1506 /* Truncate name if necessary, GDI32 can't deal with long names */
1507 if(lstrlenW(name) > LF_FACESIZE - 1)
1508 name[LF_FACESIZE - 1] = 0;
1509
1510 lfw.lfCharSet = DEFAULT_CHARSET;
1511 lstrcpyW(lfw.lfFaceName, name);
1512 lfw.lfPitchAndFamily = 0;
1513
1514 param.collection = fontCollection;
1515 param.is_system = FALSE;
1516 if (!EnumFontFamiliesExW(param.hdc, &lfw, add_font_proc, (LPARAM)&param, 0))
1517 ret = param.stat;
1518
1519 DeleteDC(param.hdc);
1520 }
1521 free(name);
1522 return ret;
1523}
1524
1525/*****************************************************************************
1526 * GdipGetFontCollectionFamilyCount [GDIPLUS.@]
1527 */
1529 GpFontCollection* fontCollection, INT* numFound)
1530{
1531 TRACE("%p, %p\n", fontCollection, numFound);
1532
1533 if (!(fontCollection && numFound))
1534 return InvalidParameter;
1535
1536 *numFound = fontCollection->count;
1537 return Ok;
1538}
1539
1540/*****************************************************************************
1541 * GdipGetFontCollectionFamilyList [GDIPLUS.@]
1542 */
1544 GpFontCollection* fontCollection, INT numSought,
1545 GpFontFamily* gpfamilies[], INT* numFound)
1546{
1547 INT i;
1548
1549 TRACE("%p, %d, %p, %p\n", fontCollection, numSought, gpfamilies, numFound);
1550
1551 if (!(fontCollection && gpfamilies && numFound))
1552 return InvalidParameter;
1553
1554 memset(gpfamilies, 0, sizeof(*gpfamilies) * numSought);
1555
1556 for (i = 0; i < numSought && i < fontCollection->count; i++)
1557 {
1558 /* caller is responsible for cloning these if it keeps references */
1559 gpfamilies[i] = fontCollection->FontFamilies[i];
1560 }
1561
1562 *numFound = i;
1563
1564 return Ok;
1565}
1566
1568{
1569 INT i;
1570
1571 for (i = 0; i < installedFontCollection.count; i++)
1574
1577}
1578
1579static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
1581{
1582 struct add_font_param *param = (struct add_font_param *)lParam;
1583 GpFontCollection *fonts = param->collection;
1584 GpFontFamily *family;
1585 HFONT hfont, old_hfont;
1586 struct font_metrics fm;
1587 int i;
1588
1589 param->stat = Ok;
1590
1591 if (type == RASTER_FONTTYPE)
1592 return 1;
1593
1594 /* skip rotated fonts */
1595 if (lfw->lfFaceName[0] == '@')
1596 return 1;
1597
1598 if (fonts->count && wcsicmp(lfw->lfFaceName, fonts->FontFamilies[fonts->count-1]->FamilyName) == 0)
1599 return 1;
1600
1601 if (fonts->allocated == fonts->count)
1602 {
1603 INT new_alloc_count = fonts->allocated+50;
1604 GpFontFamily** new_family_list = malloc(new_alloc_count * sizeof(void*));
1605
1606 if (!new_family_list)
1607 {
1608 param->stat = OutOfMemory;
1609 return 0;
1610 }
1611
1612 memcpy(new_family_list, fonts->FontFamilies, fonts->count*sizeof(void*));
1613 free(fonts->FontFamilies);
1614 fonts->FontFamilies = new_family_list;
1615 fonts->allocated = new_alloc_count;
1616 }
1617
1618 family = malloc(sizeof(*family));
1619 if (!family)
1620 {
1621 if (param->is_system)
1622 return 1;
1623
1624 param->stat = OutOfMemory;
1625 return 0;
1626 }
1627
1628 /* skip duplicates */
1629 for (i=0; i<fonts->count; i++)
1630 {
1631 if (wcsicmp(lfw->lfFaceName, fonts->FontFamilies[i]->FamilyName) == 0)
1632 {
1633 free(family);
1634 return 1;
1635 }
1636 }
1637
1639 old_hfont = SelectObject(param->hdc, hfont);
1640
1641 if (!get_font_metrics(param->hdc, &fm))
1642 {
1643 SelectObject(param->hdc, old_hfont);
1645
1646 free(family);
1647 param->stat = OutOfMemory;
1648 return 0;
1649 }
1650
1651 SelectObject(param->hdc, old_hfont);
1653
1654 family->em_height = fm.em_height;
1655 family->ascent = fm.ascent;
1656 family->descent = fm.descent;
1657 family->line_spacing = fm.line_spacing;
1658 family->dpi = fm.dpi;
1659 family->installed = param->is_system;
1660 family->ref = 1;
1661
1662 lstrcpyW(family->FamilyName, lfw->lfFaceName);
1663
1664 fonts->FontFamilies[fonts->count++] = family;
1665
1666 return 1;
1667}
1668
1670 GpFontCollection** fontCollection)
1671{
1672 TRACE("(%p)\n",fontCollection);
1673
1674 if (!fontCollection)
1675 return InvalidParameter;
1676
1679 {
1680 struct add_font_param param;
1681 LOGFONTW lfw;
1682
1683 param.hdc = CreateCompatibleDC(0);
1684
1685 lfw.lfCharSet = DEFAULT_CHARSET;
1686 lfw.lfFaceName[0] = 0;
1687 lfw.lfPitchAndFamily = 0;
1688
1689 param.collection = &installedFontCollection;
1690 param.is_system = TRUE;
1691 if (!EnumFontFamiliesExW(param.hdc, &lfw, add_font_proc, (LPARAM)&param, 0))
1692 {
1694 DeleteDC(param.hdc);
1696 return param.stat;
1697 }
1698
1699 DeleteDC(param.hdc);
1700 }
1702
1703 *fontCollection = &installedFontCollection;
1704
1705 return Ok;
1706}
static HFONT hfont
unsigned short UINT16
Definition: actypes.h:129
#define stat
Definition: acwin.h:100
Arabic default style
Definition: afstyles.h:94
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
LPARAM lParam
Definition: combotst.c:139
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define LF_FACESIZE
Definition: dimm.idl:39
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
float REAL
Definition: types.h:41
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
#define GetFileSizeEx
Definition: compat.h:757
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MapViewOfFile
Definition: compat.h:745
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define wcsicmp
Definition: compat.h:15
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
#define TT_APPLE_ID_ISO_10646
Definition: font.c:1135
GpStatus WINGDIPAPI GdipGetFontSize(GpFont *font, REAL *size)
Definition: font.c:352
#define MS_HHEA_TAG
Definition: font.c:116
#define MS_OS2_TAG
Definition: font.c:115
GpStatus WINGDIPAPI GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height)
Definition: font.c:530
static WORD get_mac_code_page(const tt_name_record *name)
Definition: font.c:1304
#define NAME_ID_FULL_FONT_NAME
Definition: font.c:1143
GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily *family, GpFontFamily **clone)
Definition: font.c:754
GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
Definition: font.c:821
GpStatus WINGDIPAPI GdipGetFamily(GpFont *font, GpFontFamily **family)
Definition: font.c:321
static INT get_font_style(const GpFont *font)
Definition: font.c:364
GpStatus WINGDIPAPI GdipDeleteFont(GpFont *font)
Definition: font.c:272
static WCHAR * load_ttf_name_id(const BYTE *mem, DWORD_PTR size, DWORD id)
Definition: font.c:1386
GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, GDIPCONST LOGFONTW *logfont, GpFont **font)
Definition: font.c:204
static BOOL get_font_metrics(HDC hdc, struct font_metrics *fm)
Definition: font.c:632
GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC hdc, GDIPCONST LOGFONTA *lfa, GpFont **font)
Definition: font.c:251
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: font.c:121
GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics, LOGFONTA *lfa)
Definition: font.c:434
#define TT_MAC_ID_SIMPLIFIED_CHINESE
Definition: font.c:1141
GpStatus WINGDIPAPI GdipCreateFontFromDC(HDC hdc, GpFont **font)
Definition: font.c:288
GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily)
Definition: font.c:997
GpStatus WINGDIPAPI GdipGetCellDescent(GDIPCONST GpFontFamily *family, INT style, UINT16 *CellDescent)
Definition: font.c:845
GpStatus WINGDIPAPI GdipNewInstalledFontCollection(GpFontCollection **fontCollection)
Definition: font.c:1669
GpStatus WINGDIPAPI GdipGetFontStyle(GpFont *font, INT *style)
Definition: font.c:395
GpStatus WINGDIPAPI GdipGetFontCollectionFamilyCount(GpFontCollection *fontCollection, INT *numFound)
Definition: font.c:1528
#define TT_MS_ID_UNICODE_CS
Definition: font.c:1139
#define TT_PLATFORM_MICROSOFT
Definition: font.c:1132
GpStatus WINGDIPAPI GdipPrivateAddMemoryFont(GpFontCollection *fontCollection, GDIPCONST void *memory, INT length)
Definition: font.c:1479
static WCHAR * copy_name_table_string(const tt_name_record *name, const BYTE *data)
Definition: font.c:1357
void free_installed_fonts(void)
Definition: font.c:1567
static GpFontCollection installedFontCollection
Definition: font.c:118
GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
Definition: font.c:457
GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily)
Definition: font.c:1029
GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily, REAL emSize, INT style, Unit unit, GpFont **font)
Definition: font.c:150
#define TT_APPLE_ID_DEFAULT
Definition: font.c:1134
GpStatus WINGDIPAPI GdipGetCellAscent(GDIPCONST GpFontFamily *family, INT style, UINT16 *CellAscent)
Definition: font.c:834
#define TT_APPLE_ID_UNICODE_2_0
Definition: font.c:1136
#define TT_PLATFORM_MACINTOSH
Definition: font.c:1131
GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height)
Definition: font.c:577
#define TT_MS_ID_SYMBOL_CS
Definition: font.c:1138
GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList(GpFontCollection *fontCollection, INT numSought, GpFontFamily *gpfamilies[], INT *numFound)
Definition: font.c:1543
GpStatus WINGDIPAPI GdipGetFontUnit(GpFont *font, Unit *unit)
Definition: font.c:419
GpStatus WINGDIPAPI GdipGetLineSpacing(GDIPCONST GpFontFamily *family, INT style, UINT16 *LineSpacing)
Definition: font.c:899
static CRITICAL_SECTION font_cs
Definition: font.c:120
GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontCollection)
Definition: font.c:1076
static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
Definition: font.c:610
static int match_name_table_language(const tt_name_record *name, LANGID lang)
Definition: font.c:1311
GpStatus WINGDIPAPI GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily)
Definition: font.c:965
GpStatus WINGDIPAPI GdipIsStyleAvailable(GDIPCONST GpFontFamily *family, INT style, BOOL *IsStyleAvailable)
Definition: font.c:930
GpStatus WINGDIPAPI GdipGetFamilyName(GDIPCONST GpFontFamily *family, WCHAR *name, LANGID language)
Definition: font.c:786
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:1130
GpStatus WINGDIPAPI GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16 *EmHeight)
Definition: font.c:872
static REAL get_font_size(const GpFont *font)
Definition: font.c:331
GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
Definition: font.c:503
GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection *collection, GDIPCONST WCHAR *name)
Definition: font.c:1095
static INT CALLBACK font_has_style_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
Definition: font.c:915
GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, GpFontCollection *collection, GpFontFamily **family)
Definition: font.c:701
#define GET_BE_WORD(x)
Definition: font.c:108
GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection **fontCollection)
Definition: font.c:1054
#define GET_BE_DWORD(x)
Definition: font.c:109
static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
Definition: font.c:1579
#define TT_HEADER_VERSION_1
Definition: font.c:1153
#define TT_HEADER_VERSION_CFF
Definition: font.c:1154
static const LANGID mac_langid_table[]
Definition: font.c:1180
GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL *dpi)
Definition: graphics.c:7002
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:288
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:239
LANGID WINAPI GetSystemDefaultLangID(void)
Definition: locale.c:1199
BOOL WINAPI IsValidCodePage(UINT codepage)
Definition: locale.c:2081
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r reserved
Definition: btrfs.c:3006
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi, BOOL printer_display)
Definition: gdiplus.c:329
REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi, BOOL printer_display)
Definition: gdiplus.c:356
void transform_properties(GpGraphics *, GDIPCONST GpMatrix *, BOOL, REAL *, REAL *, REAL *)
Definition: graphics.c:5696
static INT gdip_round(REAL x)
void get_log_fontW(const GpFont *, GpGraphics *, LOGFONTW *)
Definition: graphics.c:2353
@ FontStyleUnderline
Definition: gdiplusenums.h:305
@ FontStyleBold
Definition: gdiplusenums.h:302
@ FontStyleStrikeout
Definition: gdiplusenums.h:306
@ FontStyleRegular
Definition: gdiplusenums.h:301
@ FontStyleItalic
Definition: gdiplusenums.h:303
@ MatrixOrderAppend
Definition: gdiplusenums.h:188
Unit
Definition: gdiplusenums.h:26
@ UnitDisplay
Definition: gdiplusenums.h:28
@ UnitWorld
Definition: gdiplusenums.h:27
@ UnitPixel
Definition: gdiplusenums.h:29
#define GDIPCONST
Definition: gdiplusflat.h:24
#define WINGDIPAPI
Definition: gdiplusflat.h:22
Status
Definition: gdiplustypes.h:24
@ Ok
Definition: gdiplustypes.h:25
@ InvalidParameter
Definition: gdiplustypes.h:27
@ OutOfMemory
Definition: gdiplustypes.h:28
@ NotTrueTypeFont
Definition: gdiplustypes.h:41
@ FontFamilyNotFound
Definition: gdiplustypes.h:39
@ GenericError
Definition: gdiplustypes.h:26
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLuint GLenum matrix
Definition: glext.h:9407
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLfloat angle
Definition: glext.h:10853
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722
GLuint id
Definition: glext.h:5910
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define debugstr_w
Definition: kernel32.h:32
USHORT LANGID
Definition: mui.h:9
#define M_PI
Definition: macros.h:263
LONG_PTR LPARAM
Definition: minwindef.h:175
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static char memory[1024 *256]
Definition: process.c:122
static ICollection collection
Definition: typelib.c:184
Definition: mk_font.cpp:20
#define LANG_SCOTTISH_GAELIC
#define OBJ_FONT
Definition: objidl.idl:1019
short WCHAR
Definition: pedump.c:58
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
char CHAR
Definition: pedump.c:57
png_const_structrp png_const_inforp int * unit
Definition: png.h:2392
#define calloc
Definition: rosglue.h:14
#define LANG_TATAR
Definition: nls.h:130
#define SUBLANG_DUTCH_BELGIAN
Definition: nls.h:221
#define LANG_CROATIAN
Definition: nls.h:46
#define LANG_MALAYALAM
Definition: nls.h:93
#define LANG_TIGRIGNA
Definition: nls.h:134
#define LANG_HINDI
Definition: nls.h:68
#define LANG_TAMIL
Definition: nls.h:129
#define LANG_MALTESE
Definition: nls.h:94
#define LANG_FARSI
Definition: nls.h:55
#define LANG_NEUTRAL
Definition: nls.h:22
#define LANG_THAI
Definition: nls.h:132
#define LANG_LITHUANIAN
Definition: nls.h:88
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_LAO
Definition: nls.h:86
#define LANG_ASSAMESE
Definition: nls.h:31
#define LANG_NORWEGIAN
Definition: nls.h:102
#define LANG_CHINESE_SIMPLIFIED
Definition: nls.h:43
#define LANG_ALBANIAN
Definition: nls.h:26
#define LANG_TURKISH
Definition: nls.h:136
#define LANG_SANSKRIT
Definition: nls.h:115
#define LANG_KASHMIRI
Definition: nls.h:78
#define LANG_DANISH
Definition: nls.h:48
#define LANG_AMHARIC
Definition: nls.h:28
#define LANG_INUKTITUT
Definition: nls.h:73
#define LANG_SPANISH
Definition: nls.h:123
#define LANG_POLISH
Definition: nls.h:107
#define LANG_AZERI
Definition: nls.h:32
#define LANG_NEPALI
Definition: nls.h:101
#define LANG_QUECHUA
Definition: nls.h:110
#define LANG_GALICIAN
Definition: nls.h:60
#define LANG_INDONESIAN
Definition: nls.h:72
#define LANG_GERMAN
Definition: nls.h:62
#define LANG_ESTONIAN
Definition: nls.h:53
#define LANG_HEBREW
Definition: nls.h:67
#define LANG_KANNADA
Definition: nls.h:77
#define LANG_ORIYA
Definition: nls.h:104
#define LANG_CHINESE_TRADITIONAL
Definition: nls.h:44
#define LANG_UKRAINIAN
Definition: nls.h:139
#define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA
Definition: nls.h:296
#define LANG_URDU
Definition: nls.h:141
#define LANG_BULGARIAN
Definition: nls.h:40
#define LANG_FINNISH
Definition: nls.h:57
#define LANG_BELARUSIAN
Definition: nls.h:35
#define LANG_GEORGIAN
Definition: nls.h:61
#define LANG_GREEK
Definition: nls.h:63
#define LANG_BASQUE
Definition: nls.h:34
#define LANG_PASHTO
Definition: nls.h:105
#define LANG_MACEDONIAN
Definition: nls.h:91
#define LANG_ENGLISH
Definition: nls.h:52
#define LANG_SINHALESE
Definition: nls.h:119
#define LANG_ROMANIAN
Definition: nls.h:111
#define LANG_MALAY
Definition: nls.h:92
#define LANG_BENGALI
Definition: nls.h:36
#define LANG_DUTCH
Definition: nls.h:51
#define LANG_TURKMEN
Definition: nls.h:137
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define LANG_RUSSIAN
Definition: nls.h:113
#define LANG_VIETNAMESE
Definition: nls.h:143
#define LANG_PUNJABI
Definition: nls.h:109
#define LANG_CZECH
Definition: nls.h:47
#define LANG_HUNGARIAN
Definition: nls.h:69
#define LANG_SWEDISH
Definition: nls.h:125
#define LANG_ARABIC
Definition: nls.h:29
#define LANG_KYRGYZ
Definition: nls.h:85
#define LANG_GREENLANDIC
Definition: nls.h:64
#define LANG_SERBIAN
Definition: nls.h:116
#define SUBLANG_AZERI_CYRILLIC
Definition: nls.h:197
#define LANG_JAPANESE
Definition: nls.h:76
#define LANG_SAMI
Definition: nls.h:114
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_LATVIAN
Definition: nls.h:87
#define LANG_BRETON
Definition: nls.h:39
#define LANG_TIBETAN
Definition: nls.h:133
#define LANG_ICELANDIC
Definition: nls.h:70
#define LANG_SINDHI
Definition: nls.h:118
#define LANG_UIGHUR
Definition: nls.h:138
#define LANG_SLOVAK
Definition: nls.h:120
#define LANG_KOREAN
Definition: nls.h:84
#define LANG_AFRIKAANS
Definition: nls.h:25
#define LANG_SLOVENIAN
Definition: nls.h:121
#define LANG_TAJIK
Definition: nls.h:127
#define LANG_GUJARATI
Definition: nls.h:65
#define LANG_WELSH
Definition: nls.h:144
#define LANG_MARATHI
Definition: nls.h:98
#define LANG_SWAHILI
Definition: nls.h:124
#define LANG_FRENCH
Definition: nls.h:58
#define LANG_UZBEK
Definition: nls.h:142
#define LANG_TELUGU
Definition: nls.h:131
#define LANG_ITALIAN
Definition: nls.h:75
#define LANG_ARMENIAN
Definition: nls.h:30
#define LANG_KHMER
Definition: nls.h:80
#define LANG_PORTUGUESE
Definition: nls.h:108
#define LANG_CATALAN
Definition: nls.h:41
#define LANG_KAZAK
Definition: nls.h:79
#define SUBLANG_IRISH_IRELAND
Definition: nls.h:268
#define LANG_MONGOLIAN
Definition: nls.h:100
#define LANG_IRISH
Definition: nls.h:74
#define SUBLANG_AZERI_LATIN
Definition: nls.h:196
#define LANG_FAEROESE
Definition: nls.h:54
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
GpFontFamily ** FontFamilies
WCHAR FamilyName[LF_FACESIZE]
GpMatrix worldtrans
BOOL printer_display
GpMatrix gdi_transform
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG lfOrientation
Definition: dimm.idl:62
BYTE lfUnderline
Definition: dimm.idl:65
LONG lfEscapement
Definition: dimm.idl:61
BYTE lfCharSet
Definition: dimm.idl:67
Definition: font.c:86
USHORT advanceWidthMax
Definition: font.c:91
SHORT xMaxExtent
Definition: font.c:94
SHORT minRightSideBearing
Definition: font.c:93
SHORT caretOffset
Definition: font.c:97
SHORT caretSlopeRise
Definition: font.c:95
ULONG Version
Definition: font.c:87
SHORT minLeftSideBearing
Definition: font.c:92
SHORT LineGap
Definition: font.c:90
SHORT caretSlopeRun
Definition: font.c:96
SHORT metricDataFormat
Definition: font.c:99
SHORT Descender
Definition: font.c:89
SHORT Ascender
Definition: font.c:88
USHORT numberOfHMetrics
Definition: font.c:100
Definition: font.c:39
PANOSE panose
Definition: font.c:56
SHORT fsType
Definition: font.c:44
ULONG ulUnicodeRange2
Definition: font.c:58
SHORT ySubscriptYSize
Definition: font.c:46
USHORT usMaxContext
Definition: font.c:82
USHORT usWinAscent
Definition: font.c:72
SHORT xAvgCharWidth
Definition: font.c:41
SHORT sFamilyClass
Definition: font.c:55
ULONG ulUnicodeRange4
Definition: font.c:60
SHORT yStrikeoutSize
Definition: font.c:53
USHORT sTypoDescender
Definition: font.c:70
USHORT fsSelection
Definition: font.c:62
USHORT usWinDescent
Definition: font.c:73
USHORT usWeightClass
Definition: font.c:42
SHORT ySubscriptXOffset
Definition: font.c:47
SHORT ySuperscriptXSize
Definition: font.c:49
USHORT usFirstCharIndex
Definition: font.c:63
USHORT sTypoLineGap
Definition: font.c:71
ULONG ulUnicodeRange1
Definition: font.c:57
USHORT sTypoAscender
Definition: font.c:69
USHORT usDefaultChar
Definition: font.c:80
ULONG ulUnicodeRange3
Definition: font.c:59
ULONG ulCodePageRange1
Definition: font.c:75
SHORT ySubscriptXSize
Definition: font.c:45
SHORT sxHeight
Definition: font.c:78
SHORT ySuperscriptYSize
Definition: font.c:50
SHORT ySuperscriptYOffset
Definition: font.c:52
USHORT usLastCharIndex
Definition: font.c:64
SHORT ySuperscriptXOffset
Definition: font.c:51
USHORT usWidthClass
Definition: font.c:43
USHORT version
Definition: font.c:40
SHORT yStrikeoutPosition
Definition: font.c:54
ULONG ulCodePageRange2
Definition: font.c:76
USHORT usBreakChar
Definition: font.c:81
SHORT sCapHeight
Definition: font.c:79
SHORT ySubscriptYOffset
Definition: font.c:48
TEXTMETRICW otmTextMetrics
Definition: wingdi.h:2960
GpFontCollection * collection
Definition: font.c:1468
GpStatus stat
Definition: font.c:1470
BOOL is_system
Definition: font.c:1469
Definition: fci.c:127
int dpi
Definition: font.c:629
UINT16 em_height
Definition: font.c:628
UINT16 ascent
Definition: font.c:628
UINT16 line_spacing
Definition: font.c:628
UINT16 descent
Definition: font.c:628
WCHAR facename[LF_FACESIZE]
Definition: font.c:627
Definition: mem.c:349
Definition: name.c:39
Definition: stat.h:66
Definition: ps.c:97
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:3138
BYTE tmItalic
Definition: wingdi.h:2844
BYTE tmStruckOut
Definition: wingdi.h:2846
LONG tmInternalLeading
Definition: wingdi.h:2832
BYTE tmUnderlined
Definition: wingdi.h:2845
LONG tmWeight
Definition: wingdi.h:2836
LONG tmHeight
Definition: wingdi.h:2829
Definition: ecma_167.h:138
USHORT entry_selector
Definition: font.c:1149
USHORT tables_no
Definition: font.c:1147
ULONG version
Definition: font.c:1146
USHORT search_range
Definition: font.c:1148
USHORT range_shift
Definition: font.c:1150
USHORT offset
Definition: font.c:1175
USHORT encoding_id
Definition: font.c:1171
USHORT length
Definition: font.c:1174
USHORT language_id
Definition: font.c:1172
USHORT platform_id
Definition: font.c:1170
USHORT name_id
Definition: font.c:1173
USHORT string_offset
Definition: font.c:1166
USHORT count
Definition: font.c:1165
USHORT format
Definition: font.c:1164
ULONG check_sum
Definition: font.c:1158
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
static const WCHAR lang[]
Definition: wbemdisp.c:287
DWORD WINAPI GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
Definition: font.c:2801
#define dpi
Definition: sysparams.c:23
int codepage
Definition: win_iconv.c:156
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define FW_REGULAR
Definition: wingdi.h:374
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define DEFAULT_CHARSET
Definition: wingdi.h:384
int WINAPI EnumFontFamiliesW(_In_ HDC, _In_opt_ LPCWSTR, _In_ FONTENUMPROCW, _In_ LPARAM)
int WINAPI GetTextFaceW(_In_ HDC hdc, _In_ int c, _Out_writes_to_opt_(c, return) LPWSTR lpName)
#define RASTER_FONTTYPE
Definition: wingdi.h:1107
#define GDI_ERROR
Definition: wingdi.h:1309
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI DeleteDC(_In_ HDC)
HANDLE WINAPI AddFontMemResourceEx(_In_reads_bytes_(cjSize) PVOID pvFileView, _In_ DWORD cjSize, _Reserved_ PVOID pvResrved, _In_ DWORD *pNumFonts)
unsigned char BYTE
Definition: xxhash.c:193