Imported Upstream version 58.1
[platform/upstream/icu.git] / source / test / letest / cfonts.cpp
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4  *
5  * (C) Copyright IBM Corp. 1998-2014 - All Rights Reserved
6  *
7  */
8
9 #ifndef USING_ICULEHB /* C API not available under HB */
10
11 #include "layout/LETypes.h"
12 #include "loengine.h"
13 #include "PortableFontInstance.h"
14 #include "SimpleFontInstance.h"
15
16 U_CDECL_BEGIN
17
18 le_font *le_portableFontOpen(const char *fileName,
19                                         float pointSize,
20                                         LEErrorCode *status)
21 {
22         return (le_font *) new PortableFontInstance(fileName, pointSize, *status);
23 }
24
25 le_font *le_simpleFontOpen(float pointSize,
26                                   LEErrorCode *status)
27 {
28         return (le_font *) new SimpleFontInstance(pointSize, *status);
29 }
30
31 void le_fontClose(le_font *font)
32 {
33         LEFontInstance *fontInstance = (LEFontInstance *) font;
34
35         delete fontInstance;
36 }
37
38 const char *le_getNameString(le_font *font, le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language)
39 {
40         PortableFontInstance *pfi = (PortableFontInstance *) font;
41
42         return pfi->getNameString(nameID, platform, encoding, language);
43 }
44
45 const LEUnicode16 *le_getUnicodeNameString(le_font *font, le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language)
46 {
47         PortableFontInstance *pfi = (PortableFontInstance *) font;
48
49         return pfi->getUnicodeNameString(nameID, platform, encoding, language);
50 }
51
52 void le_deleteNameString(le_font *font, const char *name)
53 {
54         PortableFontInstance *pfi = (PortableFontInstance *) font;
55
56         pfi->deleteNameString(name);
57 }
58
59 void le_deleteUnicodeNameString(le_font *font, const LEUnicode16 *name)
60 {
61         PortableFontInstance *pfi = (PortableFontInstance *) font;
62
63         pfi->deleteNameString(name);
64 }
65
66 le_uint32 le_getFontChecksum(le_font *font)
67 {
68         PortableFontInstance *pfi = (PortableFontInstance *) font;
69
70         return pfi->getFontChecksum();
71 }
72
73 U_CDECL_END
74 #endif