215b27dff9afdfbf0fe6c183abb802a0d3df887d
4 * Copyright 2009 Massimo Del Fedele
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/port.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(dibdrv
);
29 /**********************************************************************
32 COLORREF
DIBDRV_SetTextColor( DIBDRVPHYSDEV
*physDev
, COLORREF color
)
38 MAYBE(TRACE("physDev:%p, color:%08x\n", physDev
, color
));
42 /* DIB section selected in, use DIB Engine */
44 /* do nothing if color is the same as actual one */
45 if(color
== physDev
->textColor
)
48 /* stores old color */
49 res
= physDev
->textColor
;
51 /* fills the text color table used on antialiased font display */
52 if(physDev
->physBitmap
.funcs
)
57 for(i
= 0; i
< 256; i
++)
59 physDev
->textColorTable
[i
] = physDev
->physBitmap
.funcs
->ColorToPixel(&physDev
->physBitmap
, RGB(
67 /* returns previous text color */
72 /* DDB selected in, use X11 driver */
73 res
= _DIBDRV_GetDisplayDriver()->pSetTextColor(physDev
->X11PhysDev
, color
);
78 /***********************************************************************
81 HFONT
DIBDRV_SelectFont( DIBDRVPHYSDEV
*physDev
, HFONT hfont
, GdiFont
*gdiFont
)
86 FT_CharMap charmap
= NULL
;
89 MAYBE(TRACE("physDev:%p, hfont:%p, gdiFont:%p\n", physDev
, hfont
, gdiFont
));
93 /* DIB section selected in, use DIB Engine */
95 /* gets font information */
96 GetObjectW(hfont
, sizeof(lf
), &lf
);
97 MAYBE(TRACE("Font is : '%s'\n", debugstr_w(lf
.lfFaceName
)));
99 /* FIXME: just handles gdifont, don't know if it needs to handle hfont too
100 BTW, still don't know how to get FT_Face from non-gdi font here
104 FIXME("No gdi font - unhandled by now.\n");
108 physDev
->face
= gdiFont
->ft_face
;
111 FIXME("Error, null Ft_Face\n");
115 /* setup the correct charmap.... maybe */
116 for (i
= 0; i
< physDev
->face
->num_charmaps
; ++i
)
118 if (physDev
->face
->charmaps
[i
]->platform_id
!= TT_PLATFORM_MICROSOFT
)
121 if (physDev
->face
->charmaps
[i
]->encoding_id
== TT_MS_ID_UNICODE_CS
)
123 charmap
= physDev
->face
->charmaps
[i
];
129 WARN("Selected fallout charmap #%d\n", i
);
130 charmap
= physDev
->face
->charmaps
[i
];
135 WARN("No Windows character map found\n");
136 charmap
= physDev
->face
->charmaps
[0];
140 error
= pFT_Set_Charmap(physDev
->face
, charmap
);
141 if (error
!= FT_Err_Ok
)
143 ERR("%s returned %i\n", "FT_Set_Charmap", error
);
147 /* we use GDI fonts, so just return false */
153 /* DDB selected in, use X11 driver */
154 res
= _DIBDRV_GetDisplayDriver()->pSelectFont(physDev
->X11PhysDev
, hfont
, gdiFont
);
159 /***********************************************************************
160 * DIBDRV_EnumDeviceFonts
162 BOOL
DIBDRV_EnumDeviceFonts( DIBDRVPHYSDEV
*physDev
, LPLOGFONTW plf
,
163 FONTENUMPROCW proc
, LPARAM lp
)
167 MAYBE(TRACE("physDev:%p, plf:%p, proc:%p, lp:%lx\n", physDev
, plf
, proc
, lp
));
171 /* DIB section selected in, use DIB Engine */
172 ONCE(FIXME("STUB\n"));
177 /* DDB selected in, use X11 driver */
178 res
= _DIBDRV_GetDisplayDriver()->pEnumDeviceFonts(physDev
->X11PhysDev
, plf
, proc
, lp
);
183 /***********************************************************************
184 * DIBDRV_GetTextMetrics
186 BOOL
DIBDRV_GetTextMetrics( DIBDRVPHYSDEV
*physDev
, TEXTMETRICW
*metrics
)
190 MAYBE(TRACE("physDev:%p, metrics:%p\n", physDev
, metrics
));
194 /* DIB section selected in, use DIB Engine */
195 ONCE(FIXME("STUB\n"));
200 /* DDB selected in, use X11 driver */
201 res
= _DIBDRV_GetDisplayDriver()->pGetTextMetrics(physDev
->X11PhysDev
, metrics
);
206 /***********************************************************************
207 * DIBDRV_GetCharWidth
209 BOOL
DIBDRV_GetCharWidth( DIBDRVPHYSDEV
*physDev
, UINT firstChar
, UINT lastChar
,
214 MAYBE(TRACE("physDev:%p, firstChar:%d, lastChar:%d, buffer:%pn", physDev
, firstChar
, lastChar
, buffer
));
218 /* DIB section selected in, use DIB Engine */
219 ONCE(FIXME("STUB\n"));
224 /* DDB selected in, use X11 driver */
225 res
= _DIBDRV_GetDisplayDriver()->pGetCharWidth(physDev
->X11PhysDev
, firstChar
, lastChar
, buffer
);