Imported Upstream version 58.1
[platform/upstream/icu.git] / source / samples / layout / gdiglue.cpp
1 /*
2  *
3  * Copyright (C) 2016 and later: Unicode, Inc. and others.
4  * License & terms of use: http://www.unicode.org/copyright.html#License
5  *
6  * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
7  *
8  */
9
10 #include <windows.h>
11
12 #include "unicode/utypes.h"
13 #include "loengine.h"
14 #include "rsurface.h"
15 #include "gsupport.h"
16
17 #include "gdiglue.h"
18
19 #include "LETypes.h"
20 #include "LEFontInstance.h"
21 #include "GDIGUISupport.h"
22 #include "GDIFontMap.h"
23 #include "ScriptCompositeFontInstance.h"
24
25
26 U_CDECL_BEGIN
27
28 gs_guiSupport *gs_gdiGuiSupportOpen()
29 {
30     return (gs_guiSupport *) new GDIGUISupport();
31 }
32
33 void gs_gdiGuiSupportClose(gs_guiSupport *guiSupport)
34 {
35     GDIGUISupport *gs = (GDIGUISupport *) guiSupport;
36
37     delete gs;
38 }
39
40 rs_surface *rs_gdiRenderingSurfaceOpen(HDC hdc)
41 {
42     return (rs_surface *) new GDISurface(hdc);
43 }
44
45 void rs_gdiRenderingSurfaceSetHDC(rs_surface *surface, HDC hdc)
46 {
47     GDISurface *rs = (GDISurface *) surface;
48
49     rs->setHDC(hdc);
50 }
51
52 void rs_gdiRenderingSurfaceClose(rs_surface *surface)
53 {
54     GDISurface *rs = (GDISurface *) surface;
55
56     delete rs;
57 }
58
59 fm_fontMap *fm_gdiFontMapOpen(rs_surface *surface, const char *fileName, le_int16 pointSize, gs_guiSupport *guiSupport, LEErrorCode *status)
60 {
61     return (fm_fontMap *) new GDIFontMap((GDISurface *) surface, fileName, pointSize, (GDIGUISupport *) guiSupport, *status);
62 }
63
64 void fm_fontMapClose(fm_fontMap *fontMap)
65 {
66     GDIFontMap *fm = (GDIFontMap *) fontMap;
67
68     delete fm;
69 }
70
71 le_font *le_scriptCompositeFontOpen(fm_fontMap *fontMap)
72 {
73     return (le_font *) new ScriptCompositeFontInstance((FontMap *) fontMap);
74 }
75
76 void le_fontClose(le_font *font)
77 {
78     LEFontInstance *fi = (LEFontInstance *) font;
79
80     delete fi;
81 }
82
83 U_CDECL_END