ReactOS 0.4.17-dev-573-g8315b8c
olefont.c
Go to the documentation of this file.
1/*
2 * OLE Font encapsulation implementation
3 *
4 * This file contains an implementation of the IFont
5 * interface and the OleCreateFontIndirect API call.
6 *
7 * Copyright 1999 Francis Beaudet
8 * Copyright 2006 (Google) Benjamin Arai
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24#include <assert.h>
25#include <stdarg.h>
26#include <string.h>
27
28#define COBJMACROS
29#include "winerror.h"
30#include "windef.h"
31#include "winbase.h"
32#include "wingdi.h"
33#include "winuser.h"
34#include "wine/list.h"
35#include "objbase.h"
36#include "oleauto.h" /* for SysAllocString(....) */
37#include "ole2.h"
38#include "olectl.h"
39#include "wine/debug.h"
40#include "connpt.h" /* for CreateConnectionPoint */
41#include "oaidl.h"
42
44
45/***********************************************************************
46 * Declaration of constants used when serializing the font object.
47 */
48#define FONTPERSIST_ITALIC 0x02
49#define FONTPERSIST_UNDERLINE 0x04
50#define FONTPERSIST_STRIKETHROUGH 0x08
51
53
54/***********************************************************************
55 * List of the HFONTs it has given out, with each one having a separate
56 * ref count.
57 */
58typedef struct _HFONTItem
59{
60 struct list entry;
61
62 /* Reference count of any IFont objects that own this hfont */
64
65 /* Total reference count of any refs held by the application obtained by AddRefHfont plus any internal refs */
67
68 /* The font associated with this object. */
69 HFONT gdiFont;
70
72
74
75/* Counts how many fonts contain at least one lock */
76static LONG ifont_cnt = 0;
77
78/***********************************************************************
79 * Critical section for OLEFontImpl_hFontList
80 */
83{
87 0, 0, { (DWORD_PTR)(__FILE__ ": OLEFontImpl_csHFONTLIST") }
88};
90
91static HDC get_dc(void)
92{
93 HDC hdc;
95 if(!olefont_hdc)
99 return hdc;
100}
101
102static void delete_dc(void)
103{
105 if(olefont_hdc)
106 {
109 }
111}
112
114{
115 DeleteObject(item->gdiFont);
116 list_remove(&item->entry);
117 free(item);
118}
119
120/* Find hfont item entry in the list. Should be called while holding the crit sect */
122{
124
126 {
127 if (item->gdiFont == hfont)
128 return item;
129 }
130 return NULL;
131}
132
133/* Add an item to the list with one internal reference */
135{
136 HFONTItem *new_item = malloc(sizeof(*new_item));
137
138 if(!new_item) return E_OUTOFMEMORY;
139
140 new_item->int_refs = 1;
141 new_item->total_refs = 1;
142 new_item->gdiFont = hfont;
146 return S_OK;
147}
148
150{
153
156
157 if(item)
158 {
159 item->int_refs++;
160 item->total_refs++;
161 hr = S_OK;
162 }
164
165 return hr;
166}
167
168/* decrements the internal ref of a hfont item. If both refs are zero it'll
169 remove the item from the list and delete the hfont */
171{
174
177
178 if(item)
179 {
180 item->int_refs--;
181 item->total_refs--;
182 if(item->int_refs == 0 && item->total_refs == 0)
184 hr = S_OK;
185 }
187
188 return hr;
189}
190
192{
195
197
199 if(item)
200 {
201 item->total_refs++;
202 hr = S_OK;
203 }
205
206 return hr;
207}
208
210{
213
215
217 if(item)
218 {
219 if(--item->total_refs >= 0) hr = S_OK;
220 }
222
223 return hr;
224}
225
226/***********************************************************************
227 * Declaration of the implementation class for the IFont interface
228 */
230
232{
233 /*
234 * This class supports many interfaces. IUnknown, IFont,
235 * IDispatch, IDispFont IPersistStream and IConnectionPointContainer.
236 * The first two are supported by the first vtable, the next two are
237 * supported by the second table and the last two have their own.
238 */
244 /*
245 * Reference count for that instance of the class.
246 */
248
249 /*
250 * This structure contains the description of the class.
251 */
253
254 /*
255 * Contain the font associated with this object.
256 */
257 HFONT gdiFont;
259 /*
260 * Size ratio
261 */
264
265 /*
266 * Stash realized height (pixels) from TEXTMETRIC - used in get_Size()
267 */
269
272};
273
274static inline OLEFontImpl *impl_from_IFont(IFont *iface)
275{
276 return CONTAINING_RECORD(iface, OLEFontImpl, IFont_iface);
277}
278
280{
281 return CONTAINING_RECORD(iface, OLEFontImpl, IDispatch_iface);
282}
283
285{
286 return CONTAINING_RECORD(iface, OLEFontImpl, IPersistStream_iface);
287}
288
290{
291 return CONTAINING_RECORD(iface, OLEFontImpl, IConnectionPointContainer_iface);
292}
293
295{
296 return CONTAINING_RECORD(iface, OLEFontImpl, IPersistPropertyBag_iface);
297}
298
299
300/***********************************************************************
301 * Prototypes for the implementation functions for the IFont
302 * interface
303 */
304static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc);
305static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc);
306static ULONG WINAPI OLEFontImpl_AddRef(IFont* iface);
307
308/******************************************************************************
309 * OleCreateFontIndirect [OLEAUT32.420]
310 */
312 LPFONTDESC lpFontDesc,
313 REFIID riid,
314 LPVOID* ppvObj)
315{
316 OLEFontImpl* newFont;
317 HRESULT hr;
318 FONTDESC fd;
319
320 TRACE("(%p, %s, %p)\n", lpFontDesc, debugstr_guid(riid), ppvObj);
321
322 if (!ppvObj) return E_POINTER;
323
324 *ppvObj = 0;
325
326 if (!lpFontDesc) {
327 static WCHAR fname[] = L"System";
328
329 fd.cbSizeofstruct = sizeof(fd);
330 fd.lpstrName = fname;
331 fd.cySize.Lo = 80000;
332 fd.cySize.Hi = 0;
333 fd.sWeight = 0;
334 fd.sCharset = 0;
335 fd.fItalic = FALSE;
336 fd.fUnderline = FALSE;
337 fd.fStrikethrough = FALSE;
338 lpFontDesc = &fd;
339 }
340 else if (!lpFontDesc->lpstrName)
342
343 newFont = OLEFontImpl_Construct(lpFontDesc);
344 if (!newFont) return E_OUTOFMEMORY;
345
346 hr = IFont_QueryInterface(&newFont->IFont_iface, riid, ppvObj);
347 IFont_Release(&newFont->IFont_iface);
348
349 return hr;
350}
351
352
353/***********************************************************************
354 * Implementation of the OLEFontImpl class.
355 */
356
357/***********************************************************************
358 * OLEFont_SendNotify (internal)
359 *
360 * Sends notification messages of changed properties to any interested
361 * connections.
362 */
363static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID)
364{
365 static const LPCWSTR dispid_mapping[] =
366 {
367 L"Name",
368 NULL,
369 L"Size",
370 L"Bold",
371 L"Italic",
372 L"Underline",
373 L"Strikethrough",
374 L"Weight",
375 L"Charset"
376 };
377
378 IEnumConnections *pEnum;
379 CONNECTDATA CD;
381
382 this->dirty = TRUE;
383
384 hres = IConnectionPoint_EnumConnections(this->pPropertyNotifyCP, &pEnum);
385 if (SUCCEEDED(hres))
386 {
387 while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) {
389
390 IUnknown_QueryInterface(CD.pUnk, &IID_IPropertyNotifySink, (void**)&sink);
391 IPropertyNotifySink_OnChanged(sink, dispID);
392 IPropertyNotifySink_Release(sink);
393 IUnknown_Release(CD.pUnk);
394 }
395 IEnumConnections_Release(pEnum);
396 }
397
398 hres = IConnectionPoint_EnumConnections(this->pFontEventsCP, &pEnum);
399 if (SUCCEEDED(hres))
400 {
401 DISPPARAMS dispparams;
402 VARIANTARG vararg;
403
404 VariantInit(&vararg);
405 V_VT(&vararg) = VT_BSTR;
406 V_BSTR(&vararg) = SysAllocString(dispid_mapping[dispID]);
407
408 dispparams.cArgs = 1;
409 dispparams.cNamedArgs = 0;
410 dispparams.rgdispidNamedArgs = NULL;
411 dispparams.rgvarg = &vararg;
412
413 while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) {
414 IFontEventsDisp *disp;
415
416 IUnknown_QueryInterface(CD.pUnk, &IID_IFontEventsDisp, (void**)&disp);
417 IFontEventsDisp_Invoke(disp, DISPID_FONT_CHANGED, &IID_NULL,
418 LOCALE_NEUTRAL, INVOKE_FUNC, &dispparams, NULL,
419 NULL, NULL);
420
421 IFontEventsDisp_Release(disp);
422 IUnknown_Release(CD.pUnk);
423 }
424 VariantClear(&vararg);
425 IEnumConnections_Release(pEnum);
426 }
427}
428
429/************************************************************************
430 * OLEFontImpl_QueryInterface (IUnknown)
431 *
432 * See Windows documentation for more details on IUnknown methods.
433 */
435 IFont* iface,
436 REFIID riid,
437 void** ppvObject)
438{
439 OLEFontImpl *this = impl_from_IFont(iface);
440
441 TRACE("(%p)->(%s, %p)\n", this, debugstr_guid(riid), ppvObject);
442
443 *ppvObject = 0;
444
447 {
448 *ppvObject = this;
449 }
450 else if (IsEqualGUID(&IID_IDispatch, riid) ||
452 {
453 *ppvObject = &this->IDispatch_iface;
454 }
455 else if (IsEqualGUID(&IID_IPersist, riid) ||
457 {
458 *ppvObject = &this->IPersistStream_iface;
459 }
461 {
462 *ppvObject = &this->IConnectionPointContainer_iface;
463 }
465 {
466 *ppvObject = &this->IPersistPropertyBag_iface;
467 }
468
469 if (!*ppvObject)
470 {
471 FIXME("() : asking for unsupported interface %s\n", debugstr_guid(riid));
472 return E_NOINTERFACE;
473 }
474
475 IFont_AddRef(iface);
476
477 return S_OK;
478}
479
481{
482 OLEFontImpl *this = impl_from_IFont(iface);
483 ULONG ref = InterlockedIncrement(&this->ref);
484 TRACE("%p, refcount %lu.\n", iface, ref);
485 return ref;
486}
487
489{
490 OLEFontImpl *this = impl_from_IFont(iface);
491 ULONG ref = InterlockedDecrement(&this->ref);
492
493 TRACE("%p, refcount %lu.\n", iface, ref);
494
495 if (ref == 0)
496 {
497 ULONG fontlist_refs = InterlockedDecrement(&ifont_cnt);
498
499 /* Final IFont object so destroy font cache */
500 if (fontlist_refs == 0)
501 {
502 HFONTItem *item, *cursor2;
503
508 delete_dc();
509 }
510 else
511 {
512 dec_int_ref(this->gdiFont);
513 }
515 }
516
517 return ref;
518}
519
520typedef struct
521{
522 short orig_cs;
523 short avail_cs;
524} enum_data;
525
526static int CALLBACK font_enum_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lp)
527{
528 enum_data *data = (enum_data*)lp;
529
530 if(elf->lfCharSet == data->orig_cs)
531 {
532 data->avail_cs = data->orig_cs;
533 return 0;
534 }
535 if(data->avail_cs == -1) data->avail_cs = elf->lfCharSet;
536 return 1;
537}
538
540{
541 LOGFONTW logFont;
543 WCHAR text_face[LF_FACESIZE];
544 HDC hdc = get_dc();
545 HFONT old_font;
547
548 if (!This->dirty) return;
549
550 text_face[0] = 0;
551
552 if(This->gdiFont)
553 {
554 old_font = SelectObject(hdc, This->gdiFont);
555 GetTextFaceW(hdc, ARRAY_SIZE(text_face), text_face);
556 SelectObject(hdc, old_font);
557 dec_int_ref(This->gdiFont);
558 This->gdiFont = 0;
559 }
560
561 memset(&logFont, 0, sizeof(LOGFONTW));
562
563 lstrcpynW(logFont.lfFaceName, This->description.lpstrName, LF_FACESIZE);
564 logFont.lfCharSet = This->description.sCharset;
565
566 /* If the font name has been changed then enumerate all charsets
567 and pick one that'll result in the font specified being selected */
568 if(text_face[0] && lstrcmpiW(text_face, This->description.lpstrName))
569 {
571 data.orig_cs = This->description.sCharset;
572 data.avail_cs = -1;
573 logFont.lfCharSet = DEFAULT_CHARSET;
575 if(data.avail_cs != -1) logFont.lfCharSet = data.avail_cs;
576 }
577
578 /*
579 * The height of the font returned by the get_Size property is the
580 * height of the font in points multiplied by 10000... Using some
581 * simple conversions and the ratio given by the application, it can
582 * be converted to a height in pixels.
583 *
584 * Standard ratio is 72 / 2540, or 18 / 635 in lowest terms.
585 * Ratio is applied here relative to the standard.
586 */
587
588 fontHeight = MulDiv( This->description.cySize.Lo, This->cyLogical*635, This->cyHimetric*18 );
589
590 logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L) - 1 :
591 (-fontHeight/10000L);
592 logFont.lfItalic = This->description.fItalic;
593 logFont.lfUnderline = This->description.fUnderline;
594 logFont.lfStrikeOut = This->description.fStrikethrough;
595 logFont.lfWeight = This->description.sWeight;
598 logFont.lfQuality = DEFAULT_QUALITY;
600
601 This->gdiFont = CreateFontIndirectW(&logFont);
602 This->dirty = FALSE;
603
604 add_hfontitem(This->gdiFont);
605
606 /* Fixup the name and charset properties so that they match the
607 selected font */
608 old_font = SelectObject(get_dc(), This->gdiFont);
609 GetTextFaceW(hdc, ARRAY_SIZE(text_face), text_face);
610 if(lstrcmpiW(text_face, This->description.lpstrName))
611 {
612 free(This->description.lpstrName);
613 This->description.lpstrName = wcsdup(text_face);
614 }
616 This->description.sCharset = tm.tmCharSet;
617 /* While we have it handy, stash the realized font height for use by get_Size() */
618 This->nRealHeight = tm.tmHeight - tm.tmInternalLeading; /* corresponds to LOGFONT lfHeight */
619 SelectObject(hdc, old_font);
620}
621
622/************************************************************************
623 * OLEFontImpl_get_Name (IFont)
624 *
625 * See Windows documentation for more details on IFont methods.
626 */
628 IFont* iface,
629 BSTR* pname)
630{
631 OLEFontImpl *this = impl_from_IFont(iface);
632 TRACE("(%p)->(%p)\n", this, pname);
633
634 if (pname==0)
635 return E_POINTER;
636
637 realize_font(this);
638
639 *pname = SysAllocString(this->description.lpstrName);
640
641 return S_OK;
642}
643
644/************************************************************************
645 * OLEFontImpl_put_Name (IFont)
646 */
648 IFont* iface,
649 BSTR name)
650{
652 TRACE("(%p)->(%p)\n", This, name);
653
654 if (!name)
656
657 free(This->description.lpstrName);
658 This->description.lpstrName = wcsdup(name);
659 if (!This->description.lpstrName) return E_OUTOFMEMORY;
660
661 TRACE("new name %s\n", debugstr_w(This->description.lpstrName));
663 return S_OK;
664}
665
666/************************************************************************
667 * OLEFontImpl_get_Size (IFont)
668 */
670 IFont* iface,
671 CY* psize)
672{
673 OLEFontImpl *this = impl_from_IFont(iface);
674 TRACE("(%p)->(%p)\n", this, psize);
675
676 if (!psize) return E_POINTER;
677
678 realize_font(this);
679
680 /*
681 * Convert realized font height in pixels to points descaled by current
682 * scaling ratio then scaled up by 10000.
683 */
684 psize->Lo = MulDiv(this->nRealHeight, this->cyHimetric * 72 * 10000, this->cyLogical * 2540);
685 psize->Hi = 0;
686
687 return S_OK;
688}
689
691{
692 OLEFontImpl *this = impl_from_IFont(iface);
693 TRACE("%p, %ld.\n", iface, size.Lo);
694 this->description.cySize.Hi = 0;
695 this->description.cySize.Lo = size.Lo;
697
698 return S_OK;
699}
700
702{
703 OLEFontImpl *this = impl_from_IFont(iface);
704 TRACE("(%p)->(%p)\n", this, pbold);
705
706 if (!pbold) return E_POINTER;
707
708 realize_font(this);
709
710 *pbold = this->description.sWeight > 550;
711
712 return S_OK;
713}
714
715/************************************************************************
716 * OLEFontImpl_put_Bold (IFont)
717 */
719 IFont* iface,
720 BOOL bold)
721{
722 OLEFontImpl *this = impl_from_IFont(iface);
723 TRACE("(%p)->(%d)\n", this, bold);
724 this->description.sWeight = bold ? FW_BOLD : FW_NORMAL;
726
727 return S_OK;
728}
729
730/************************************************************************
731 * OLEFontImpl_get_Italic (IFont)
732 */
734 IFont* iface,
735 BOOL* pitalic)
736{
737 OLEFontImpl *this = impl_from_IFont(iface);
738 TRACE("(%p)->(%p)\n", this, pitalic);
739
740 if (pitalic==0)
741 return E_POINTER;
742
743 realize_font(this);
744
745 *pitalic = this->description.fItalic;
746
747 return S_OK;
748}
749
750/************************************************************************
751 * OLEFontImpl_put_Italic (IFont)
752 */
754 IFont* iface,
755 BOOL italic)
756{
757 OLEFontImpl *this = impl_from_IFont(iface);
758 TRACE("(%p)->(%d)\n", this, italic);
759
760 this->description.fItalic = italic;
761
763 return S_OK;
764}
765
766/************************************************************************
767 * OLEFontImpl_get_Underline (IFont)
768 */
770 IFont* iface,
771 BOOL* punderline)
772{
773 OLEFontImpl *this = impl_from_IFont(iface);
774 TRACE("(%p)->(%p)\n", this, punderline);
775
776 if (punderline==0)
777 return E_POINTER;
778
779 realize_font(this);
780
781 *punderline = this->description.fUnderline;
782
783 return S_OK;
784}
785
786/************************************************************************
787 * OLEFontImpl_put_Underline (IFont)
788 */
790 IFont* iface,
791 BOOL underline)
792{
793 OLEFontImpl *this = impl_from_IFont(iface);
794 TRACE("(%p)->(%d)\n", this, underline);
795
796 this->description.fUnderline = underline;
797
799 return S_OK;
800}
801
802/************************************************************************
803 * OLEFontImpl_get_Strikethrough (IFont)
804 */
806 IFont* iface,
807 BOOL* pstrikethrough)
808{
809 OLEFontImpl *this = impl_from_IFont(iface);
810 TRACE("(%p)->(%p)\n", this, pstrikethrough);
811
812 if (pstrikethrough==0)
813 return E_POINTER;
814
815 realize_font(this);
816
817 *pstrikethrough = this->description.fStrikethrough;
818
819 return S_OK;
820}
821
822/************************************************************************
823 * OLEFontImpl_put_Strikethrough (IFont)
824 */
826 IFont* iface,
827 BOOL strikethrough)
828{
829 OLEFontImpl *this = impl_from_IFont(iface);
830 TRACE("(%p)->(%d)\n", this, strikethrough);
831
832 this->description.fStrikethrough = strikethrough;
834
835 return S_OK;
836}
837
838/************************************************************************
839 * OLEFontImpl_get_Weight (IFont)
840 */
842 IFont* iface,
843 short* pweight)
844{
845 OLEFontImpl *this = impl_from_IFont(iface);
846 TRACE("(%p)->(%p)\n", this, pweight);
847
848 if (pweight==0)
849 return E_POINTER;
850
851 realize_font(this);
852
853 *pweight = this->description.sWeight;
854
855 return S_OK;
856}
857
858/************************************************************************
859 * OLEFontImpl_put_Weight (IFont)
860 */
862 IFont* iface,
863 short weight)
864{
865 OLEFontImpl *this = impl_from_IFont(iface);
866 TRACE("(%p)->(%d)\n", this, weight);
867
868 this->description.sWeight = weight;
869
871 return S_OK;
872}
873
874/************************************************************************
875 * OLEFontImpl_get_Charset (IFont)
876 */
878 IFont* iface,
879 short* pcharset)
880{
881 OLEFontImpl *this = impl_from_IFont(iface);
882 TRACE("(%p)->(%p)\n", this, pcharset);
883
884 if (pcharset==0)
885 return E_POINTER;
886
887 realize_font(this);
888
889 *pcharset = this->description.sCharset;
890
891 return S_OK;
892}
893
894/************************************************************************
895 * OLEFontImpl_put_Charset (IFont)
896 */
898 IFont* iface,
899 short charset)
900{
901 OLEFontImpl *this = impl_from_IFont(iface);
902 TRACE("(%p)->(%d)\n", this, charset);
903
904 this->description.sCharset = charset;
906
907 return S_OK;
908}
909
910/************************************************************************
911 * OLEFontImpl_get_hFont (IFont)
912 */
914 IFont* iface,
915 HFONT* phfont)
916{
917 OLEFontImpl *this = impl_from_IFont(iface);
918 TRACE("(%p)->(%p)\n", this, phfont);
919 if (phfont==NULL)
920 return E_POINTER;
921
922 realize_font(this);
923
924 *phfont = this->gdiFont;
925 TRACE("Returning %p\n", *phfont);
926 return S_OK;
927}
928
929/************************************************************************
930 * OLEFontImpl_Clone (IFont)
931 */
933 IFont* iface,
934 IFont** ppfont)
935{
936 OLEFontImpl *this = impl_from_IFont(iface);
937 OLEFontImpl* newObject;
938
939 TRACE("(%p)->(%p)\n", this, ppfont);
940
941 if (ppfont == NULL)
942 return E_POINTER;
943
944 *ppfont = NULL;
945
946 newObject = malloc(sizeof(OLEFontImpl));
947 if (newObject==NULL)
948 return E_OUTOFMEMORY;
949
950 *newObject = *this;
951 /* allocate separate buffer */
952 newObject->description.lpstrName = wcsdup(this->description.lpstrName);
953
954 /* Increment internal ref in hfont item list */
955 if(newObject->gdiFont) inc_int_ref(newObject->gdiFont);
956
958
959 newObject->pPropertyNotifyCP = NULL;
960 newObject->pFontEventsCP = NULL;
962 &newObject->pPropertyNotifyCP);
964 &newObject->pFontEventsCP);
965
966 if (!newObject->pPropertyNotifyCP || !newObject->pFontEventsCP)
967 {
968 OLEFontImpl_Destroy(newObject);
969 return E_OUTOFMEMORY;
970 }
971
972 /* The cloned object starts with a reference count of 1 */
973 newObject->ref = 1;
974
975 *ppfont = &newObject->IFont_iface;
976
977 return S_OK;
978}
979
980/************************************************************************
981 * OLEFontImpl_IsEqual (IFont)
982 */
984 IFont* iface,
985 IFont* pFontOther)
986{
988 OLEFontImpl *right = impl_from_IFont(pFontOther);
989 INT ret;
990 INT left_len,right_len;
991
992 if(pFontOther == NULL)
993 return E_POINTER;
994 else if (left->description.cySize.Lo != right->description.cySize.Lo)
995 return S_FALSE;
996 else if (left->description.cySize.Hi != right->description.cySize.Hi)
997 return S_FALSE;
998 else if (left->description.sWeight != right->description.sWeight)
999 return S_FALSE;
1000 else if (left->description.sCharset != right->description.sCharset)
1001 return S_FALSE;
1002 else if (left->description.fItalic != right->description.fItalic)
1003 return S_FALSE;
1004 else if (left->description.fUnderline != right->description.fUnderline)
1005 return S_FALSE;
1006 else if (left->description.fStrikethrough != right->description.fStrikethrough)
1007 return S_FALSE;
1008
1009 /* Check from string */
1010 left_len = lstrlenW(left->description.lpstrName);
1011 right_len = lstrlenW(right->description.lpstrName);
1012 ret = CompareStringW(0,0,left->description.lpstrName, left_len,
1013 right->description.lpstrName, right_len);
1014 if (ret != CSTR_EQUAL)
1015 return S_FALSE;
1016
1017 return S_OK;
1018}
1019
1020/************************************************************************
1021 * OLEFontImpl_SetRatio (IFont)
1022 */
1024 IFont* iface,
1025 LONG cyLogical,
1026 LONG cyHimetric)
1027{
1028 OLEFontImpl *this = impl_from_IFont(iface);
1029
1030 TRACE("%p, %ld, %ld.\n", iface, cyLogical, cyHimetric);
1031
1032 if(cyLogical == 0 || cyHimetric == 0)
1033 return E_FAIL;
1034
1035 /* cyLogical and cyHimetric both set to 1 is a special case that
1036 does not change the scaling but also does not fail */
1037 if(cyLogical == 1 && cyHimetric == 1)
1038 return S_OK;
1039
1040 this->cyLogical = cyLogical;
1041 this->cyHimetric = cyHimetric;
1042 this->dirty = TRUE;
1043
1044 return S_OK;
1045}
1046
1047/************************************************************************
1048 * OLEFontImpl_QueryTextMetrics (IFont)
1049 */
1051 IFont* iface,
1052 TEXTMETRICOLE* ptm)
1053{
1054 HDC hdcRef;
1055 HFONT hOldFont, hNewFont;
1056
1057 hdcRef = GetDC(0);
1058 IFont_get_hFont(iface, &hNewFont);
1059 hOldFont = SelectObject(hdcRef, hNewFont);
1060 GetTextMetricsW(hdcRef, ptm);
1061 SelectObject(hdcRef, hOldFont);
1062 ReleaseDC(0, hdcRef);
1063 return S_OK;
1064}
1065
1066/************************************************************************
1067 * OLEFontImpl_AddRefHfont (IFont)
1068 */
1070 IFont* iface,
1071 HFONT hfont)
1072{
1073 OLEFontImpl *this = impl_from_IFont(iface);
1074
1075 TRACE("(%p)->(%p)\n", this, hfont);
1076
1077 if (!hfont) return E_INVALIDARG;
1078
1079 return inc_ext_ref(hfont);
1080}
1081
1082/************************************************************************
1083 * OLEFontImpl_ReleaseHfont (IFont)
1084 */
1086 IFont* iface,
1087 HFONT hfont)
1088{
1089 OLEFontImpl *this = impl_from_IFont(iface);
1090
1091 TRACE("(%p)->(%p)\n", this, hfont);
1092
1093 if (!hfont) return E_INVALIDARG;
1094
1095 return dec_ext_ref(hfont);
1096}
1097
1098/************************************************************************
1099 * OLEFontImpl_SetHdc (IFont)
1100 */
1102 IFont* iface,
1103 HDC hdc)
1104{
1105 OLEFontImpl *this = impl_from_IFont(iface);
1106 FIXME("(%p)->(%p): Stub\n", this, hdc);
1107 return E_NOTIMPL;
1108}
1109
1110static const IFontVtbl OLEFontImpl_VTable =
1111{
1139};
1140
1141/************************************************************************
1142 * OLEFontImpl_IDispatch_QueryInterface (IUnknown)
1143 */
1145 IDispatch* iface,
1146 REFIID riid,
1147 VOID** ppvoid)
1148{
1149 OLEFontImpl *this = impl_from_IDispatch(iface);
1150 return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
1151}
1152
1153/************************************************************************
1154 * OLEFontImpl_IDispatch_Release (IUnknown)
1155 */
1157 IDispatch* iface)
1158{
1159 OLEFontImpl *this = impl_from_IDispatch(iface);
1160 return IFont_Release(&this->IFont_iface);
1161}
1162
1163/************************************************************************
1164 * OLEFontImpl_IDispatch_AddRef (IUnknown)
1165 */
1167 IDispatch* iface)
1168{
1169 OLEFontImpl *this = impl_from_IDispatch(iface);
1170 return IFont_AddRef(&this->IFont_iface);
1171}
1172
1173/************************************************************************
1174 * OLEFontImpl_GetTypeInfoCount (IDispatch)
1175 */
1177 IDispatch* iface,
1178 unsigned int* pctinfo)
1179{
1180 OLEFontImpl *this = impl_from_IDispatch(iface);
1181 TRACE("(%p)->(%p)\n", this, pctinfo);
1182 *pctinfo = 1;
1183
1184 return S_OK;
1185}
1186
1187/************************************************************************
1188 * OLEFontImpl_GetTypeInfo (IDispatch)
1189 */
1191 IDispatch* iface,
1192 UINT iTInfo,
1193 LCID lcid,
1194 ITypeInfo** ppTInfo)
1195{
1196 ITypeLib *tl;
1197 HRESULT hres;
1198
1199 OLEFontImpl *this = impl_from_IDispatch(iface);
1200 TRACE("(%p, iTInfo=%d, lcid=%04x, %p)\n", this, iTInfo, (int)lcid, ppTInfo);
1201 if (iTInfo != 0)
1202 return E_FAIL;
1203 hres = LoadTypeLib(L"stdole2.tlb", &tl);
1204 if (FAILED(hres)) {
1205 ERR("Could not load the stdole2.tlb?\n");
1206 return hres;
1207 }
1208 hres = ITypeLib_GetTypeInfoOfGuid(tl, &IID_IFontDisp, ppTInfo);
1209 ITypeLib_Release(tl);
1210 if (FAILED(hres))
1211 FIXME("Did not IDispatch typeinfo from typelib, hres %#lx.\n", hres);
1212
1213 return hres;
1214}
1215
1216/************************************************************************
1217 * OLEFontImpl_GetIDsOfNames (IDispatch)
1218 */
1220 IDispatch* iface,
1221 REFIID riid,
1222 LPOLESTR* rgszNames,
1223 UINT cNames,
1224 LCID lcid,
1225 DISPID* rgDispId)
1226{
1227 ITypeInfo * pTInfo;
1228 HRESULT hres;
1229
1230 OLEFontImpl *this = impl_from_IDispatch(iface);
1231
1232 TRACE("(%p,%s,%p,cNames=%d,lcid=%04x,%p)\n", this, debugstr_guid(riid),
1233 rgszNames, cNames, (int)lcid, rgDispId);
1234
1235 if (cNames == 0) return E_INVALIDARG;
1236
1237 hres = IDispatch_GetTypeInfo(iface, 0, lcid, &pTInfo);
1238 if (FAILED(hres))
1239 {
1240 ERR("GetTypeInfo failed.\n");
1241 return hres;
1242 }
1243
1244 /* convert names to DISPIDs */
1245 hres = DispGetIDsOfNames (pTInfo, rgszNames, cNames, rgDispId);
1246 ITypeInfo_Release(pTInfo);
1247
1248 return hres;
1249}
1250
1251/************************************************************************
1252 * OLEFontImpl_Invoke (IDispatch)
1253 *
1254 */
1256 IDispatch* iface,
1257 DISPID dispIdMember,
1258 REFIID riid,
1259 LCID lcid,
1260 WORD wFlags,
1261 DISPPARAMS* pDispParams,
1262 VARIANT* pVarResult,
1263 EXCEPINFO* pExepInfo,
1264 UINT* puArgErr)
1265{
1266 OLEFontImpl *this = impl_from_IDispatch(iface);
1267 HRESULT hr;
1268
1269 TRACE("%p, %ld, %s, %#lx, %#x, %p, %p, %p, %p.\n", iface, dispIdMember,
1270 debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExepInfo,
1271 puArgErr);
1272
1273 /* validate parameters */
1274
1275 if (!IsEqualIID(riid, &IID_NULL))
1276 {
1277 ERR("riid was %s instead of IID_NULL\n", debugstr_guid(riid));
1279 }
1280
1282 {
1283 if (!pVarResult)
1284 {
1285 ERR("null pVarResult not allowed when DISPATCH_PROPERTYGET specified\n");
1287 }
1288 }
1289 else if (wFlags & DISPATCH_PROPERTYPUT)
1290 {
1291 if (!pDispParams)
1292 {
1293 ERR("null pDispParams not allowed when DISPATCH_PROPERTYPUT specified\n");
1295 }
1296 if (pDispParams->cArgs != 1)
1297 {
1298 ERR("param count for DISPATCH_PROPERTYPUT was %d instead of 1\n", pDispParams->cArgs);
1299 return DISP_E_BADPARAMCOUNT;
1300 }
1301 }
1302 else
1303 {
1304 ERR("one of DISPATCH_PROPERTYGET or DISPATCH_PROPERTYPUT must be specified\n");
1305 return DISP_E_MEMBERNOTFOUND;
1306 }
1307
1308 switch (dispIdMember) {
1309 case DISPID_FONT_NAME:
1311 V_VT(pVarResult) = VT_BSTR;
1312 return IFont_get_Name(&this->IFont_iface, &V_BSTR(pVarResult));
1313 } else {
1314 VARIANTARG vararg;
1315
1316 VariantInit(&vararg);
1317 hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BSTR);
1318 if (FAILED(hr))
1319 return hr;
1320
1321 hr = IFont_put_Name(&this->IFont_iface, V_BSTR(&vararg));
1322
1323 VariantClear(&vararg);
1324 return hr;
1325 }
1326 break;
1327 case DISPID_FONT_BOLD:
1329 BOOL value;
1330 hr = IFont_get_Bold(&this->IFont_iface, &value);
1331 V_VT(pVarResult) = VT_BOOL;
1332 V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
1333 return hr;
1334 } else {
1335 VARIANTARG vararg;
1336
1337 VariantInit(&vararg);
1338 hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BOOL);
1339 if (FAILED(hr))
1340 return hr;
1341
1342 hr = IFont_put_Bold(&this->IFont_iface, V_BOOL(&vararg));
1343
1344 VariantClear(&vararg);
1345 return hr;
1346 }
1347 break;
1348 case DISPID_FONT_ITALIC:
1350 BOOL value;
1351 hr = IFont_get_Italic(&this->IFont_iface, &value);
1352 V_VT(pVarResult) = VT_BOOL;
1353 V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
1354 return hr;
1355 } else {
1356 VARIANTARG vararg;
1357
1358 VariantInit(&vararg);
1359 hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BOOL);
1360 if (FAILED(hr))
1361 return hr;
1362
1363 hr = IFont_put_Italic(&this->IFont_iface, V_BOOL(&vararg));
1364
1365 VariantClear(&vararg);
1366 return hr;
1367 }
1368 break;
1369 case DISPID_FONT_UNDER:
1371 BOOL value;
1372 hr = IFont_get_Underline(&this->IFont_iface, &value);
1373 V_VT(pVarResult) = VT_BOOL;
1374 V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
1375 return hr;
1376 } else {
1377 VARIANTARG vararg;
1378
1379 VariantInit(&vararg);
1380 hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BOOL);
1381 if (FAILED(hr))
1382 return hr;
1383
1384 hr = IFont_put_Underline(&this->IFont_iface, V_BOOL(&vararg));
1385
1386 VariantClear(&vararg);
1387 return hr;
1388 }
1389 break;
1390 case DISPID_FONT_STRIKE:
1392 BOOL value;
1393 hr = IFont_get_Strikethrough(&this->IFont_iface, &value);
1394 V_VT(pVarResult) = VT_BOOL;
1395 V_BOOL(pVarResult) = value ? VARIANT_TRUE : VARIANT_FALSE;
1396 return hr;
1397 } else {
1398 VARIANTARG vararg;
1399
1400 VariantInit(&vararg);
1401 hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_BOOL);
1402 if (FAILED(hr))
1403 return hr;
1404
1405 hr = IFont_put_Strikethrough(&this->IFont_iface, V_BOOL(&vararg));
1406
1407 VariantClear(&vararg);
1408 return hr;
1409 }
1410 break;
1411 case DISPID_FONT_SIZE:
1413 V_VT(pVarResult) = VT_CY;
1414 return IFont_get_Size(&this->IFont_iface, &V_CY(pVarResult));
1415 } else {
1416 VARIANTARG vararg;
1417
1418 VariantInit(&vararg);
1419 hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_CY);
1420 if (FAILED(hr))
1421 return hr;
1422
1423 hr = IFont_put_Size(&this->IFont_iface, V_CY(&vararg));
1424
1425 VariantClear(&vararg);
1426 return hr;
1427 }
1428 break;
1429 case DISPID_FONT_WEIGHT:
1431 V_VT(pVarResult) = VT_I2;
1432 return IFont_get_Weight(&this->IFont_iface, &V_I2(pVarResult));
1433 } else {
1434 VARIANTARG vararg;
1435
1436 VariantInit(&vararg);
1437 hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_I2);
1438 if (FAILED(hr))
1439 return hr;
1440
1441 hr = IFont_put_Weight(&this->IFont_iface, V_I2(&vararg));
1442
1443 VariantClear(&vararg);
1444 return hr;
1445 }
1446 break;
1449 V_VT(pVarResult) = VT_I2;
1450 return OLEFontImpl_get_Charset(&this->IFont_iface, &V_I2(pVarResult));
1451 } else {
1452 VARIANTARG vararg;
1453
1454 VariantInit(&vararg);
1455 hr = VariantChangeTypeEx(&vararg, &pDispParams->rgvarg[0], lcid, 0, VT_I2);
1456 if (FAILED(hr))
1457 return hr;
1458
1459 hr = IFont_put_Charset(&this->IFont_iface, V_I2(&vararg));
1460
1461 VariantClear(&vararg);
1462 return hr;
1463 }
1464 break;
1465 default:
1466 ERR("member not found for dispid %#lx.\n", dispIdMember);
1467 return DISP_E_MEMBERNOTFOUND;
1468 }
1469}
1470
1471static const IDispatchVtbl OLEFontImpl_IDispatch_VTable =
1472{
1480};
1481
1482/************************************************************************
1483 * OLEFontImpl_IPersistStream_QueryInterface (IUnknown)
1484 */
1486 IPersistStream* iface,
1487 REFIID riid,
1488 VOID** ppvoid)
1489{
1491
1492 return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
1493}
1494
1495/************************************************************************
1496 * OLEFontImpl_IPersistStream_Release (IUnknown)
1497 */
1499 IPersistStream* iface)
1500{
1502
1503 return IFont_Release(&this->IFont_iface);
1504}
1505
1506/************************************************************************
1507 * OLEFontImpl_IPersistStream_AddRef (IUnknown)
1508 */
1510 IPersistStream* iface)
1511{
1513
1514 return IFont_AddRef(&this->IFont_iface);
1515}
1516
1517/************************************************************************
1518 * OLEFontImpl_GetClassID (IPersistStream)
1519 */
1521 IPersistStream* iface,
1522 CLSID* pClassID)
1523{
1524 TRACE("(%p,%p)\n",iface,pClassID);
1525 if (pClassID==0)
1526 return E_POINTER;
1527
1528 *pClassID = CLSID_StdFont;
1529
1530 return S_OK;
1531}
1532
1533/************************************************************************
1534 * OLEFontImpl_IsDirty (IPersistStream)
1535 *
1536 * See Windows documentation for more details on IPersistStream methods.
1537 */
1539 IPersistStream* iface)
1540{
1541 TRACE("(%p)\n",iface);
1542 return S_OK;
1543}
1544
1545/************************************************************************
1546 * OLEFontImpl_Load (IPersistStream)
1547 *
1548 * See Windows documentation for more details on IPersistStream methods.
1549 *
1550 * This is the format of the standard font serialization as far as I
1551 * know
1552 *
1553 * Offset Type Value Comment
1554 * 0x0000 Byte Unknown Probably a version number, contains 0x01
1555 * 0x0001 Short Charset Charset value from the FONTDESC structure
1556 * 0x0003 Byte Attributes Flags defined as follows:
1557 * 00000010 - Italic
1558 * 00000100 - Underline
1559 * 00001000 - Strikethrough
1560 * 0x0004 Short Weight Weight value from FONTDESC structure
1561 * 0x0006 DWORD size "Low" portion of the cySize member of the FONTDESC
1562 * structure/
1563 * 0x000A Byte name length Length of the font name string (no null character)
1564 * 0x000B String name Name of the font (ASCII, no nul character)
1565 */
1567 IPersistStream* iface,
1568 IStream* pLoadStream)
1569{
1571 BYTE version, attributes, string_size;
1572 char readBuffer[0x100];
1573 ULONG cbRead;
1574 INT len;
1575
1576 /* Version */
1577 IStream_Read(pLoadStream, &version, sizeof(BYTE), &cbRead);
1578 if ((cbRead != sizeof(BYTE)) || (version != 0x01)) return E_FAIL;
1579
1580 /* Charset */
1581 IStream_Read(pLoadStream, &this->description.sCharset, sizeof(WORD), &cbRead);
1582 if (cbRead != sizeof(WORD)) return E_FAIL;
1583
1584 /* Attributes */
1585 IStream_Read(pLoadStream, &attributes, sizeof(BYTE), &cbRead);
1586 if (cbRead != sizeof(BYTE)) return E_FAIL;
1587
1588 this->description.fItalic = (attributes & FONTPERSIST_ITALIC) != 0;
1589 this->description.fStrikethrough = (attributes & FONTPERSIST_STRIKETHROUGH) != 0;
1590 this->description.fUnderline = (attributes & FONTPERSIST_UNDERLINE) != 0;
1591
1592 /* Weight */
1593 IStream_Read(pLoadStream, &this->description.sWeight, sizeof(WORD), &cbRead);
1594 if (cbRead != sizeof(WORD)) return E_FAIL;
1595
1596 /* Size */
1597 IStream_Read(pLoadStream, &this->description.cySize.Lo, sizeof(DWORD), &cbRead);
1598 if (cbRead != sizeof(DWORD)) return E_FAIL;
1599
1600 this->description.cySize.Hi = 0;
1601
1602 /* Name */
1603 IStream_Read(pLoadStream, &string_size, sizeof(BYTE), &cbRead);
1604 if (cbRead != sizeof(BYTE)) return E_FAIL;
1605
1606 IStream_Read(pLoadStream, readBuffer, string_size, &cbRead);
1607 if (cbRead != string_size) return E_FAIL;
1608
1609 free(this->description.lpstrName);
1610
1611 len = MultiByteToWideChar( CP_ACP, 0, readBuffer, string_size, NULL, 0 );
1612 this->description.lpstrName = malloc((len + 1) * sizeof(WCHAR));
1613 MultiByteToWideChar( CP_ACP, 0, readBuffer, string_size, this->description.lpstrName, len );
1614 this->description.lpstrName[len] = 0;
1615
1616 /* Ensure use of this font causes a new one to be created */
1617 dec_int_ref(this->gdiFont);
1618 this->gdiFont = 0;
1619 this->dirty = TRUE;
1620
1621 return S_OK;
1622}
1623
1624/************************************************************************
1625 * OLEFontImpl_Save (IPersistStream)
1626 */
1628 IPersistStream* iface,
1629 IStream* pOutStream,
1630 BOOL fClearDirty)
1631{
1633 BYTE attributes, string_size;
1634 const BYTE version = 0x01;
1635 char* writeBuffer = NULL;
1636 ULONG written;
1637
1638 TRACE("(%p)->(%p %d)\n", this, pOutStream, fClearDirty);
1639
1640 /* Version */
1641 IStream_Write(pOutStream, &version, sizeof(BYTE), &written);
1642 if (written != sizeof(BYTE)) return E_FAIL;
1643
1644 /* Charset */
1645 IStream_Write(pOutStream, &this->description.sCharset, sizeof(WORD), &written);
1646 if (written != sizeof(WORD)) return E_FAIL;
1647
1648 /* Attributes */
1649 attributes = 0;
1650
1651 if (this->description.fItalic)
1652 attributes |= FONTPERSIST_ITALIC;
1653
1654 if (this->description.fStrikethrough)
1655 attributes |= FONTPERSIST_STRIKETHROUGH;
1656
1657 if (this->description.fUnderline)
1658 attributes |= FONTPERSIST_UNDERLINE;
1659
1660 IStream_Write(pOutStream, &attributes, sizeof(BYTE), &written);
1661 if (written != sizeof(BYTE)) return E_FAIL;
1662
1663 /* Weight */
1664 IStream_Write(pOutStream, &this->description.sWeight, sizeof(WORD), &written);
1665 if (written != sizeof(WORD)) return E_FAIL;
1666
1667 /* Size */
1668 IStream_Write(pOutStream, &this->description.cySize.Lo, sizeof(DWORD), &written);
1669 if (written != sizeof(DWORD)) return E_FAIL;
1670
1671 /* FontName */
1672 string_size = WideCharToMultiByte( CP_ACP, 0, this->description.lpstrName,
1673 lstrlenW(this->description.lpstrName), NULL, 0, NULL, NULL );
1674
1675 IStream_Write(pOutStream, &string_size, sizeof(BYTE), &written);
1676 if (written != sizeof(BYTE)) return E_FAIL;
1677
1678 if (string_size)
1679 {
1680 if (!(writeBuffer = malloc(string_size))) return E_OUTOFMEMORY;
1681 WideCharToMultiByte( CP_ACP, 0, this->description.lpstrName,
1682 lstrlenW(this->description.lpstrName),
1683 writeBuffer, string_size, NULL, NULL );
1684
1685 IStream_Write(pOutStream, writeBuffer, string_size, &written);
1687
1688 if (written != string_size) return E_FAIL;
1689 }
1690
1691 return S_OK;
1692}
1693
1694/************************************************************************
1695 * OLEFontImpl_GetSizeMax (IPersistStream)
1696 */
1698 IPersistStream* iface,
1699 ULARGE_INTEGER* pcbSize)
1700{
1702
1703 if (pcbSize==NULL)
1704 return E_POINTER;
1705
1706 pcbSize->u.HighPart = 0;
1707 pcbSize->u.LowPart = 0;
1708
1709 pcbSize->u.LowPart += sizeof(BYTE); /* Version */
1710 pcbSize->u.LowPart += sizeof(WORD); /* Lang code */
1711 pcbSize->u.LowPart += sizeof(BYTE); /* Flags */
1712 pcbSize->u.LowPart += sizeof(WORD); /* Weight */
1713 pcbSize->u.LowPart += sizeof(DWORD); /* Size */
1714 pcbSize->u.LowPart += sizeof(BYTE); /* StrLength */
1715
1716 pcbSize->u.LowPart += WideCharToMultiByte( CP_ACP, 0, this->description.lpstrName,
1717 lstrlenW(this->description.lpstrName),
1718 NULL, 0, NULL, NULL );
1719
1720 return S_OK;
1721}
1722
1723static const IPersistStreamVtbl OLEFontImpl_IPersistStream_VTable =
1724{
1733};
1734
1735/************************************************************************
1736 * OLEFontImpl_IConnectionPointContainer_QueryInterface (IUnknown)
1737 */
1740 REFIID riid,
1741 VOID** ppvoid)
1742{
1744
1745 return IFont_QueryInterface(&this->IFont_iface, riid, ppvoid);
1746}
1747
1748/************************************************************************
1749 * OLEFontImpl_IConnectionPointContainer_Release (IUnknown)
1750 */
1753{
1755
1756 return IFont_Release(&this->IFont_iface);
1757}
1758
1759/************************************************************************
1760 * OLEFontImpl_IConnectionPointContainer_AddRef (IUnknown)
1761 */
1764{
1766
1767 return IFont_AddRef(&this->IFont_iface);
1768}
1769
1770/************************************************************************
1771 * OLEFontImpl_EnumConnectionPoints (IConnectionPointContainer)
1772 */
1775 IEnumConnectionPoints **ppEnum)
1776{
1778
1779 FIXME("(%p)->(%p): stub\n", this, ppEnum);
1780 return E_NOTIMPL;
1781}
1782
1783/************************************************************************
1784 * OLEFontImpl_FindConnectionPoint (IConnectionPointContainer)
1785 */
1788 REFIID riid,
1789 IConnectionPoint **ppCp)
1790{
1792 TRACE("(%p)->(%s, %p)\n", this, debugstr_guid(riid), ppCp);
1793
1795 return IConnectionPoint_QueryInterface(this->pPropertyNotifyCP, &IID_IConnectionPoint,
1796 (void**)ppCp);
1797 } else if(IsEqualIID(riid, &IID_IFontEventsDisp)) {
1798 return IConnectionPoint_QueryInterface(this->pFontEventsCP, &IID_IConnectionPoint,
1799 (void**)ppCp);
1800 } else {
1801 FIXME("no connection point for %s\n", debugstr_guid(riid));
1803 }
1804}
1805
1806static const IConnectionPointContainerVtbl
1808{
1814};
1815
1816/************************************************************************
1817 * OLEFontImpl implementation of IPersistPropertyBag.
1818 */
1820 IPersistPropertyBag *iface, REFIID riid, LPVOID *ppvObj
1821) {
1823 return IFont_QueryInterface(&this->IFont_iface,riid,ppvObj);
1824}
1825
1827 IPersistPropertyBag *iface
1828) {
1830 return IFont_AddRef(&this->IFont_iface);
1831}
1832
1834 IPersistPropertyBag *iface
1835) {
1837 return IFont_Release(&this->IFont_iface);
1838}
1839
1841 IPersistPropertyBag *iface, CLSID *classid
1842) {
1843 FIXME("(%p,%p), stub!\n", iface, classid);
1844 return E_FAIL;
1845}
1846
1848 IPersistPropertyBag *iface
1849) {
1850 FIXME("(%p), stub!\n", iface);
1851 return S_OK;
1852}
1853
1855 IPersistPropertyBag *iface, IPropertyBag* pPropBag, IErrorLog* pErrorLog
1856) {
1857/* (from Visual Basic 6 property bag)
1858 Name = "MS Sans Serif"
1859 Size = 13.8
1860 Charset = 0
1861 Weight = 400
1862 Underline = 0 'False
1863 Italic = 0 'False
1864 Strikethrough = 0 'False
1865*/
1867 VARIANT value;
1868 HRESULT iRes;
1869
1871
1872 iRes = IPropertyBag_Read(pPropBag, L"Name", &value, pErrorLog);
1873 if (iRes == S_OK)
1874 {
1875 iRes = VariantChangeType(&value, &value, 0, VT_BSTR);
1876 if (iRes == S_OK)
1877 iRes = IFont_put_Name(&this->IFont_iface, V_BSTR(&value));
1878 }
1879 else if (iRes == E_INVALIDARG)
1880 iRes = S_OK;
1881
1883
1884 if (iRes == S_OK) {
1885 iRes = IPropertyBag_Read(pPropBag, L"Size", &value, pErrorLog);
1886 if (iRes == S_OK)
1887 {
1888 iRes = VariantChangeType(&value, &value, 0, VT_CY);
1889 if (iRes == S_OK)
1890 iRes = IFont_put_Size(&this->IFont_iface, V_CY(&value));
1891 }
1892 else if (iRes == E_INVALIDARG)
1893 iRes = S_OK;
1894
1896 }
1897
1898 if (iRes == S_OK) {
1899 iRes = IPropertyBag_Read(pPropBag, L"Charset", &value, pErrorLog);
1900 if (iRes == S_OK)
1901 {
1902 iRes = VariantChangeType(&value, &value, 0, VT_I2);
1903 if (iRes == S_OK)
1904 iRes = IFont_put_Charset(&this->IFont_iface, V_I2(&value));
1905 }
1906 else if (iRes == E_INVALIDARG)
1907 iRes = S_OK;
1908
1910 }
1911
1912 if (iRes == S_OK) {
1913 iRes = IPropertyBag_Read(pPropBag, L"Weight", &value, pErrorLog);
1914 if (iRes == S_OK)
1915 {
1916 iRes = VariantChangeType(&value, &value, 0, VT_I2);
1917 if (iRes == S_OK)
1918 iRes = IFont_put_Weight(&this->IFont_iface, V_I2(&value));
1919 }
1920 else if (iRes == E_INVALIDARG)
1921 iRes = S_OK;
1922
1924 }
1925
1926 if (iRes == S_OK) {
1927 iRes = IPropertyBag_Read(pPropBag, L"Underline", &value, pErrorLog);
1928 if (iRes == S_OK)
1929 {
1930 iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
1931 if (iRes == S_OK)
1932 iRes = IFont_put_Underline(&this->IFont_iface, V_BOOL(&value));
1933 }
1934 else if (iRes == E_INVALIDARG)
1935 iRes = S_OK;
1936
1938 }
1939
1940 if (iRes == S_OK) {
1941 iRes = IPropertyBag_Read(pPropBag, L"Italic", &value, pErrorLog);
1942 if (iRes == S_OK)
1943 {
1944 iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
1945 if (iRes == S_OK)
1946 iRes = IFont_put_Italic(&this->IFont_iface, V_BOOL(&value));
1947 }
1948 else if (iRes == E_INVALIDARG)
1949 iRes = S_OK;
1950
1952 }
1953
1954 if (iRes == S_OK) {
1955 iRes = IPropertyBag_Read(pPropBag, L"Strikethrough", &value, pErrorLog);
1956 if (iRes == S_OK)
1957 {
1958 iRes = VariantChangeType(&value, &value, 0, VT_BOOL);
1959 if (iRes == S_OK)
1960 IFont_put_Strikethrough(&this->IFont_iface, V_BOOL(&value));
1961 }
1962 else if (iRes == E_INVALIDARG)
1963 iRes = S_OK;
1964
1966 }
1967
1968 if (FAILED(iRes))
1969 WARN("-- %#lx.\n", iRes);
1970 return iRes;
1971}
1972
1974 IPersistPropertyBag *iface, IPropertyBag* pPropBag, BOOL fClearDirty,
1975 BOOL fSaveAllProperties
1976) {
1977 FIXME("(%p,%p,%d,%d), stub!\n", iface, pPropBag, fClearDirty, fSaveAllProperties);
1978 return E_FAIL;
1979}
1980
1981static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable =
1982{
1986
1991};
1992
1993/************************************************************************
1994 * OLEFontImpl_Construct
1995 *
1996 * This method will construct a new instance of the OLEFontImpl
1997 * class.
1998 *
1999 * The caller of this method must release the object when it's
2000 * done with it.
2001 */
2003{
2004 OLEFontImpl* newObject;
2005
2006 newObject = malloc(sizeof(OLEFontImpl));
2007
2008 if (newObject==0)
2009 return newObject;
2010
2011 newObject->IFont_iface.lpVtbl = &OLEFontImpl_VTable;
2012 newObject->IDispatch_iface.lpVtbl = &OLEFontImpl_IDispatch_VTable;
2016
2017 newObject->ref = 1;
2018
2019 newObject->description.cbSizeofstruct = sizeof(FONTDESC);
2020 newObject->description.lpstrName = wcsdup(fontDesc->lpstrName);
2021 newObject->description.cySize = fontDesc->cySize;
2022 newObject->description.sWeight = fontDesc->sWeight;
2023 newObject->description.sCharset = fontDesc->sCharset;
2024 newObject->description.fItalic = fontDesc->fItalic;
2025 newObject->description.fUnderline = fontDesc->fUnderline;
2026 newObject->description.fStrikethrough = fontDesc->fStrikethrough;
2027
2028 newObject->gdiFont = 0;
2029 newObject->dirty = TRUE;
2030 newObject->cyLogical = GetDeviceCaps(get_dc(), LOGPIXELSY);
2031 newObject->cyHimetric = 2540L;
2032 newObject->pPropertyNotifyCP = NULL;
2033 newObject->pFontEventsCP = NULL;
2034
2037
2038 if (!newObject->pPropertyNotifyCP || !newObject->pFontEventsCP)
2039 {
2040 OLEFontImpl_Destroy(newObject);
2041 return NULL;
2042 }
2043
2045
2046 TRACE("returning %p\n", newObject);
2047 return newObject;
2048}
2049
2050/************************************************************************
2051 * OLEFontImpl_Destroy
2052 *
2053 * This method is called by the Release method when the reference
2054 * count goes down to 0. It will free all resources used by
2055 * this object.
2056 */
2057static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc)
2058{
2059 TRACE("(%p)\n", fontDesc);
2060
2061 free(fontDesc->description.lpstrName);
2062
2063 if (fontDesc->pPropertyNotifyCP)
2064 IConnectionPoint_Release(fontDesc->pPropertyNotifyCP);
2065 if (fontDesc->pFontEventsCP)
2066 IConnectionPoint_Release(fontDesc->pFontEventsCP);
2067
2068 free(fontDesc);
2069}
2070
2071/*******************************************************************************
2072 * StdFont ClassFactory
2073 */
2074typedef struct
2075{
2076 /* IUnknown fields */
2077 IClassFactory IClassFactory_iface;
2078 LONG ref;
2080
2082{
2083 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
2084}
2085
2087{
2089
2090 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj);
2091
2092 *obj = NULL;
2093
2095 {
2096 *obj = iface;
2097 IClassFactory_AddRef(iface);
2098 return S_OK;
2099 }
2100
2101 return E_NOINTERFACE;
2102}
2103
2104static ULONG WINAPI
2105SFCF_AddRef(LPCLASSFACTORY iface) {
2107 return InterlockedIncrement(&This->ref);
2108}
2109
2110static ULONG WINAPI SFCF_Release(LPCLASSFACTORY iface) {
2112 /* static class, won't be freed */
2113 return InterlockedDecrement(&This->ref);
2114}
2115
2117 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
2118) {
2119 return OleCreateFontIndirect(NULL,riid,ppobj);
2120
2121}
2122
2123static HRESULT WINAPI SFCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
2125 FIXME("(%p)->(%d),stub!\n",This,dolock);
2126 return S_OK;
2127}
2128
2129static const IClassFactoryVtbl SFCF_Vtbl = {
2135};
2137
static HFONT hfont
int fontHeight
Definition: appswitch.c:46
#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
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
const GUID IID_IClassFactory
CFF_Charset charset
Definition: cffcmap.c:137
Definition: list.h:37
HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid, IConnectionPoint **pCP)
Definition: connpt.c:482
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define LF_FACESIZE
Definition: dimm.idl:39
static LPVOID LPUNKNOWN
Definition: dinput.c:53
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CP_ACP
Definition: compat.h:109
OLECHAR * BSTR
Definition: compat.h:2293
#define CALLBACK
Definition: compat.h:35
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
@ VT_BSTR
Definition: compat.h:2303
@ VT_CY
Definition: compat.h:2301
@ VT_BOOL
Definition: compat.h:2306
@ VT_I2
Definition: compat.h:2297
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: locale.c:3946
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
LCID lcid
Definition: locale.c:5660
static wchar_t * wcsdup(const wchar_t *str)
Definition: string.h:94
HRESULT WINAPI DispGetIDsOfNames(ITypeInfo *ptinfo, OLECHAR **rgszNames, UINT cNames, DISPID *rgdispid)
Definition: dispatch.c:92
static HDC get_dc(void)
Definition: olefont.c:91
static HRESULT WINAPI OLEFontImpl_put_Italic(IFont *iface, BOOL italic)
Definition: olefont.c:753
static const IPersistStreamVtbl OLEFontImpl_IPersistStream_VTable
Definition: olefont.c:1723
static ULONG WINAPI SFCF_AddRef(LPCLASSFACTORY iface)
Definition: olefont.c:2105
static void OLEFont_SendNotify(OLEFontImpl *this, DISPID dispID)
Definition: olefont.c:363
static HRESULT WINAPI OLEFontImpl_put_Charset(IFont *iface, short charset)
Definition: olefont.c:897
static HRESULT WINAPI OLEFontImpl_Save(IPersistStream *iface, IStream *pOutStream, BOOL fClearDirty)
Definition: olefont.c:1627
static OLEFontImpl * impl_from_IFont(IFont *iface)
Definition: olefont.c:274
static ULONG WINAPI SFCF_Release(LPCLASSFACTORY iface)
Definition: olefont.c:2110
struct _HFONTItem HFONTItem
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_GetClassID(IPersistPropertyBag *iface, CLSID *classid)
Definition: olefont.c:1840
#define FONTPERSIST_UNDERLINE
Definition: olefont.c:49
static IClassFactoryImpl STDFONT_CF
Definition: olefont.c:2136
HRESULT WINAPI OleCreateFontIndirect(LPFONTDESC lpFontDesc, REFIID riid, LPVOID *ppvObj)
Definition: olefont.c:311
static HRESULT WINAPI OLEFontImpl_AddRefHfont(IFont *iface, HFONT hfont)
Definition: olefont.c:1069
static void delete_dc(void)
Definition: olefont.c:102
static HRESULT WINAPI OLEFontImpl_Load(IPersistStream *iface, IStream *pLoadStream)
Definition: olefont.c:1566
static const IConnectionPointContainerVtbl OLEFontImpl_IConnectionPointContainer_VTable
Definition: olefont.c:1807
static HRESULT WINAPI OLEFontImpl_get_Weight(IFont *iface, short *pweight)
Definition: olefont.c:841
static HRESULT WINAPI OLEFontImpl_QueryTextMetrics(IFont *iface, TEXTMETRICOLE *ptm)
Definition: olefont.c:1050
#define FONTPERSIST_ITALIC
Definition: olefont.c:48
static HRESULT WINAPI OLEFontImpl_IDispatch_QueryInterface(IDispatch *iface, REFIID riid, VOID **ppvoid)
Definition: olefont.c:1144
struct _HFONTItem * PHFONTItem
static const IFontVtbl OLEFontImpl_VTable
Definition: olefont.c:1110
static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release(IConnectionPointContainer *iface)
Definition: olefont.c:1751
static HRESULT inc_ext_ref(HFONT hfont)
Definition: olefont.c:191
void _get_STDFONT_CF(LPVOID *ppv)
Definition: olefont.c:2138
static HRESULT inc_int_ref(HFONT hfont)
Definition: olefont.c:149
static int CALLBACK font_enum_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm, DWORD type, LPARAM lp)
Definition: olefont.c:526
static HRESULT WINAPI OLEFontImpl_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: olefont.c:1219
static ULONG WINAPI OLEFontImpl_IDispatch_AddRef(IDispatch *iface)
Definition: olefont.c:1166
static HRESULT WINAPI OLEFontImpl_ReleaseHfont(IFont *iface, HFONT hfont)
Definition: olefont.c:1085
static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
Definition: olefont.c:1762
static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_Release(IPersistPropertyBag *iface)
Definition: olefont.c:1833
static HFONTItem * find_hfontitem(HFONT hfont)
Definition: olefont.c:121
static CRITICAL_SECTION_DEBUG OLEFontImpl_csHFONTLIST_debug
Definition: olefont.c:82
static void realize_font(OLEFontImpl *This)
Definition: olefont.c:539
static const IClassFactoryVtbl SFCF_Vtbl
Definition: olefont.c:2129
static HRESULT WINAPI OLEFontImpl_IsDirty(IPersistStream *iface)
Definition: olefont.c:1538
static HRESULT WINAPI OLEFontImpl_SetRatio(IFont *iface, LONG cyLogical, LONG cyHimetric)
Definition: olefont.c:1023
static void HFONTItem_Delete(PHFONTItem item)
Definition: olefont.c:113
static HRESULT WINAPI SFCF_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
Definition: olefont.c:2086
static HRESULT WINAPI OLEFontImpl_get_Charset(IFont *iface, short *pcharset)
Definition: olefont.c:877
static HRESULT WINAPI OLEFontImpl_get_Size(IFont *iface, CY *psize)
Definition: olefont.c:669
static HRESULT WINAPI OLEFontImpl_IsEqual(IFont *iface, IFont *pFontOther)
Definition: olefont.c:983
static HRESULT WINAPI OLEFontImpl_put_Weight(IFont *iface, short weight)
Definition: olefont.c:861
static HRESULT WINAPI SFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
Definition: olefont.c:2116
static HRESULT WINAPI OLEFontImpl_get_Italic(IFont *iface, BOOL *pitalic)
Definition: olefont.c:733
static HRESULT WINAPI OLEFontImpl_QueryInterface(IFont *iface, REFIID riid, void **ppvObject)
Definition: olefont.c:434
static OLEFontImpl * impl_from_IDispatch(IDispatch *iface)
Definition: olefont.c:279
static HRESULT WINAPI OLEFontImpl_FindConnectionPoint(IConnectionPointContainer *iface, REFIID riid, IConnectionPoint **ppCp)
Definition: olefont.c:1786
static ULONG WINAPI OLEFontImpl_AddRef(IFont *iface)
Definition: olefont.c:480
#define FONTPERSIST_STRIKETHROUGH
Definition: olefont.c:50
static HRESULT dec_int_ref(HFONT hfont)
Definition: olefont.c:170
static HDC olefont_hdc
Definition: olefont.c:52
static HRESULT WINAPI OLEFontImpl_put_Strikethrough(IFont *iface, BOOL strikethrough)
Definition: olefont.c:825
static HRESULT WINAPI OLEFontImpl_SetHdc(IFont *iface, HDC hdc)
Definition: olefont.c:1101
static HRESULT WINAPI OLEFontImpl_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid, VOID **ppvoid)
Definition: olefont.c:1485
static OLEFontImpl * OLEFontImpl_Construct(const FONTDESC *fontDesc)
Definition: olefont.c:2002
static HRESULT WINAPI OLEFontImpl_put_Underline(IFont *iface, BOOL underline)
Definition: olefont.c:789
static HRESULT WINAPI OLEFontImpl_put_Size(IFont *iface, CY size)
Definition: olefont.c:690
static HRESULT WINAPI OLEFontImpl_get_hFont(IFont *iface, HFONT *phfont)
Definition: olefont.c:913
static HRESULT WINAPI SFCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
Definition: olefont.c:2123
static HRESULT WINAPI OLEFontImpl_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *pcbSize)
Definition: olefont.c:1697
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_QueryInterface(IPersistPropertyBag *iface, REFIID riid, LPVOID *ppvObj)
Definition: olefont.c:1819
static OLEFontImpl * impl_from_IPersistPropertyBag(IPersistPropertyBag *iface)
Definition: olefont.c:294
static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_AddRef(IPersistPropertyBag *iface)
Definition: olefont.c:1826
static HRESULT WINAPI OLEFontImpl_put_Name(IFont *iface, BSTR name)
Definition: olefont.c:647
static HRESULT WINAPI OLEFontImpl_IConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface, REFIID riid, VOID **ppvoid)
Definition: olefont.c:1738
static LONG ifont_cnt
Definition: olefont.c:76
static HRESULT WINAPI OLEFontImpl_get_Name(IFont *iface, BSTR *pname)
Definition: olefont.c:627
static HRESULT WINAPI OLEFontImpl_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo, UINT *puArgErr)
Definition: olefont.c:1255
static struct list OLEFontImpl_hFontList
Definition: olefont.c:73
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_InitNew(IPersistPropertyBag *iface)
Definition: olefont.c:1847
static ULONG WINAPI OLEFontImpl_IPersistStream_AddRef(IPersistStream *iface)
Definition: olefont.c:1509
static HRESULT dec_ext_ref(HFONT hfont)
Definition: olefont.c:209
static HRESULT WINAPI OLEFontImpl_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: olefont.c:1190
static CRITICAL_SECTION OLEFontImpl_csHFONTLIST
Definition: olefont.c:81
static HRESULT WINAPI OLEFontImpl_Clone(IFont *iface, IFont **ppfont)
Definition: olefont.c:932
static HRESULT WINAPI OLEFontImpl_EnumConnectionPoints(IConnectionPointContainer *iface, IEnumConnectionPoints **ppEnum)
Definition: olefont.c:1773
static OLEFontImpl * impl_from_IPersistStream(IPersistStream *iface)
Definition: olefont.c:284
static OLEFontImpl * impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
Definition: olefont.c:289
static void OLEFontImpl_Destroy(OLEFontImpl *fontDesc)
Definition: olefont.c:2057
static HRESULT WINAPI OLEFontImpl_get_Underline(IFont *iface, BOOL *punderline)
Definition: olefont.c:769
static const IDispatchVtbl OLEFontImpl_IDispatch_VTable
Definition: olefont.c:1471
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: olefont.c:2081
static ULONG WINAPI OLEFontImpl_IDispatch_Release(IDispatch *iface)
Definition: olefont.c:1156
static HRESULT WINAPI OLEFontImpl_GetClassID(IPersistStream *iface, CLSID *pClassID)
Definition: olefont.c:1520
static HRESULT WINAPI OLEFontImpl_get_Strikethrough(IFont *iface, BOOL *pstrikethrough)
Definition: olefont.c:805
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(IPersistPropertyBag *iface, IPropertyBag *pPropBag, IErrorLog *pErrorLog)
Definition: olefont.c:1854
static HRESULT WINAPI OLEFontImpl_GetTypeInfoCount(IDispatch *iface, unsigned int *pctinfo)
Definition: olefont.c:1176
static ULONG WINAPI OLEFontImpl_Release(IFont *iface)
Definition: olefont.c:488
static HRESULT WINAPI OLEFontImpl_get_Bold(IFont *iface, BOOL *pbold)
Definition: olefont.c:701
static HRESULT add_hfontitem(HFONT hfont)
Definition: olefont.c:134
static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable
Definition: olefont.c:1981
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Save(IPersistPropertyBag *iface, IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
Definition: olefont.c:1973
static ULONG WINAPI OLEFontImpl_IPersistStream_Release(IPersistStream *iface)
Definition: olefont.c:1498
static HRESULT WINAPI OLEFontImpl_put_Bold(IFont *iface, BOOL bold)
Definition: olefont.c:718
HRESULT WINAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib **pptLib)
Definition: typelib.c:434
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r dirty
Definition: btrfs.c:3004
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()
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint writeBuffer
Definition: glext.h:11008
GLsizeiptr size
Definition: glext.h:5919
GLenum pname
Definition: glext.h:5645
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
Definition: ocidl.idl:76
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
LONG_PTR LPARAM
Definition: minwindef.h:175
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
HRESULT hres
Definition: protocol.c:465
static const CLSID CLSID_StdFont
Definition: compobj.c:92
static VARIANTARG static DISPID
Definition: ordinal.c:49
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define DWORD
Definition: nt_native.h:44
#define LOCALE_NEUTRAL
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:240
#define V_BOOL(A)
Definition: oleauto.h:224
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_CY(A)
Definition: oleauto.h:229
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
#define V_I2(A)
Definition: oleauto.h:245
struct tagFONTDESC FONTDESC
#define DISPID_FONT_SIZE
Definition: olectl.h:428
#define DISPID_FONT_NAME
Definition: olectl.h:427
#define DISPID_FONT_BOLD
Definition: olectl.h:429
#define DISPID_FONT_STRIKE
Definition: olectl.h:432
#define CONNECT_E_NOCONNECTION
Definition: olectl.h:251
#define DISPID_FONT_ITALIC
Definition: olectl.h:430
#define CTL_E_INVALIDPROPERTYVALUE
Definition: olectl.h:292
#define DISPID_FONT_CHARSET
Definition: olectl.h:434
#define DISPID_FONT_WEIGHT
Definition: olectl.h:433
#define DISPID_FONT_CHANGED
Definition: olectl.h:435
#define DISPID_FONT_UNDER
Definition: olectl.h:431
const GUID IID_IConnectionPointContainer
const GUID IID_IConnectionPoint
const GUID IID_IPropertyNotifySink
const GUID IID_IFontEventsDisp
const GUID IID_IDispatch
const GUID IID_IFont
const GUID IID_IFontDisp
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistStream
Definition: proxy.cpp:13
const GUID IID_IPersistPropertyBag
Definition: proxy.cpp:11
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define IID_NULL
Definition: guiddef.h:98
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
DWORD LCID
Definition: nls.h:13
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
static int fd
Definition: io.c:51
#define memset(x, y, z)
Definition: compat.h:39
weight
Definition: sortkey.c:157
#define TRACE(s)
Definition: solgame.cpp:4
BYTE lfOutPrecision
Definition: dimm.idl:68
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
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfClipPrecision
Definition: dimm.idl:69
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfQuality
Definition: dimm.idl:70
BYTE lfPitchAndFamily
Definition: dimm.idl:71
IConnectionPoint * pFontEventsCP
Definition: olefont.c:271
IConnectionPoint * pPropertyNotifyCP
Definition: olefont.c:270
IPersistPropertyBag IPersistPropertyBag_iface
Definition: olefont.c:243
HFONT gdiFont
Definition: olefont.c:257
LONG ref
Definition: olefont.c:247
LONG cyHimetric
Definition: olefont.c:263
LONG cyLogical
Definition: olefont.c:262
IFont IFont_iface
Definition: olefont.c:239
IDispatch IDispatch_iface
Definition: olefont.c:240
BOOL dirty
Definition: olefont.c:258
IPersistStream IPersistStream_iface
Definition: olefont.c:241
FONTDESC description
Definition: olefont.c:252
LONG nRealHeight
Definition: olefont.c:268
IConnectionPointContainer IConnectionPointContainer_iface
Definition: olefont.c:242
HFONT gdiFont
Definition: olefont.c:69
LONG int_refs
Definition: olefont.c:63
LONG total_refs
Definition: olefont.c:66
struct list entry
Definition: olefont.c:60
struct _ULARGE_INTEGER::@4637 u
short orig_cs
Definition: olefont.c:522
short avail_cs
Definition: olefont.c:523
Definition: name.c:39
Definition: send.c:48
UINT cbSizeofstruct
Definition: olectl.h:119
SHORT sWeight
Definition: olectl.h:122
BOOL fItalic
Definition: olectl.h:124
BOOL fUnderline
Definition: olectl.h:125
BOOL fStrikethrough
Definition: olectl.h:126
SHORT sCharset
Definition: olectl.h:123
CY cySize
Definition: olectl.h:121
LPOLESTR lpstrName
Definition: olectl.h:120
#define LIST_INIT(head)
Definition: queue.h:197
#define DWORD_PTR
Definition: treelist.c:76
const uint16_t * LPCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
Definition: compat.h:2255
ULONG Lo
Definition: compat.h:2261
Definition: pdh_main.c:96
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, const VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:939
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:626
HRESULT WINAPI VariantChangeTypeEx(VARIANTARG *pvargDest, const VARIANTARG *pvargSrc, LCID lcid, USHORT wFlags, VARTYPE vt)
Definition: variant.c:965
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:547
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337
#define WINAPI
Definition: msvc.h:6
const char * description
Definition: directx.c:2497
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
#define DISP_E_UNKNOWNINTERFACE
Definition: winerror.h:3614
#define DISP_E_BADPARAMCOUNT
Definition: winerror.h:3626
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:3615
#define E_POINTER
Definition: winerror.h:3480
#define DISP_E_PARAMNOTOPTIONAL
Definition: winerror.h:3627
#define DEFAULT_PITCH
Definition: wingdi.h:443
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
#define DEFAULT_QUALITY
Definition: wingdi.h:436
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
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 GetTextFaceW(_In_ HDC hdc, _In_ int c, _Out_writes_to_opt_(c, return) LPWSTR lpName)
#define OUT_CHARACTER_PRECIS
Definition: wingdi.h:417
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
#define FW_NORMAL
Definition: wingdi.h:373
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI DeleteDC(_In_ HDC)
#define CSTR_EQUAL
Definition: winnls.h:508
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
unsigned char BYTE
Definition: xxhash.c:193