2 * Copyright (C) 2007 Google (Evan Stade)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "gdiplus_private.h"
31 GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
32 GDIPCONST LOGFONTW *logfont, GpFont **font)
38 return InvalidParameter;
40 *font = GdipAlloc(sizeof(GpFont));
41 if(!*font) return OutOfMemory;
43 memcpy(&(*font)->lfw.lfFaceName, logfont->lfFaceName, LF_FACESIZE *
45 (*font)->lfw.lfHeight = logfont->lfHeight;
46 (*font)->lfw.lfItalic = logfont->lfItalic;
47 (*font)->lfw.lfUnderline = logfont->lfUnderline;
48 (*font)->lfw.lfStrikeOut = logfont->lfStrikeOut;
50 hfont = CreateFontIndirectW(&(*font)->lfw);
51 oldfont = SelectObject(hdc, hfont);
52 GetTextMetricsW(hdc, &textmet);
54 (*font)->lfw.lfHeight = -textmet.tmHeight;
55 (*font)->lfw.lfWeight = textmet.tmWeight;
57 SelectObject(hdc, oldfont);
63 GpStatus WINGDIPAPI GdipCreateFontFromLogfontA(HDC hdc,
64 GDIPCONST LOGFONTA *lfa, GpFont **font)
69 return InvalidParameter;
71 memcpy(&lfw, lfa, sizeof(LOGFONTA));
73 if(!MultiByteToWideChar(CP_ACP, 0, lfa->lfFaceName, -1, lfw.lfFaceName, LF_FACESIZE))
76 GdipCreateFontFromLogfontW(hdc, &lfw, font);
81 GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)
84 return InvalidParameter;
91 /* FIXME: use graphics */
92 GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
95 if(!font || !graphics || !lfw)
96 return InvalidParameter;