Imported Upstream version 58.1
[platform/upstream/icu.git] / source / samples / layout / Surface.cpp
1 /*
2  *   Copyright (C) 2016 and later: Unicode, Inc. and others.
3  *   License & terms of use: http://www.unicode.org/copyright.html#License
4  *
5  *   Copyright (C) 2003, International Business Machines
6  *   Corporation and others.  All Rights Reserved.
7  */
8 void GDISurface::setFont(RenderingFontInstance *font)
9 {
10     GDIFontInstance *gFont = (GDIFontInstance *) font;
11
12     if (fCurrentFont != font) {
13         fCurrentFont = font;
14         SelectObject(fHdc, gFont->fFont);
15     }
16 }
17
18 void GDISurface::drawGlyphs(RenderingFontInstance *font, const LEGlyphID *glyphs, le_int32 count, const le_int32 *dx,
19     le_int32 x, le_int32 y, le_int32 width, le_int32 height)
20 {
21     RECT clip;
22
23     clip.top    = 0;
24     clip.left   = 0;
25     clip.bottom = height;
26     clip.right  = width;
27
28     setFont(font);
29
30     ExtTextOut(fHdc, x, y - fAscent, ETO_CLIPPED | ETO_GLYPH_INDEX, &clip,
31         glyphs, count, (INT *) dx);
32 }
33