Imported Upstream version 58.1
[platform/upstream/icu.git] / source / samples / layout / GnomeFontMap.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  ******************************************************************************
7  * Copyright (C) 1998-2006, International Business Machines Corporation and   *
8  * others. All Rights Reserved.                                               *
9  ******************************************************************************
10  */
11
12 #include <stdio.h>
13
14 #include <ft2build.h>
15 #include FT_FREETYPE_H
16
17 #include "layout/LEFontInstance.h"
18 #include "GnomeFontInstance.h"
19
20 #include "GUISupport.h"
21 #include "FontMap.h"
22 #include "GnomeFontMap.h"
23
24 GnomeFontMap::GnomeFontMap(FT_Library engine, const char *fileName, le_int16 pointSize, GUISupport *guiSupport, LEErrorCode &status)
25     : FontMap(fileName, pointSize, guiSupport, status), fEngine(engine)
26 {
27     // nothing to do?
28 }
29
30 GnomeFontMap::~GnomeFontMap()
31 {
32     // anything?
33 }
34
35 const LEFontInstance *GnomeFontMap::openFont(const char *fontName, le_int16 pointSize, LEErrorCode &status)
36 {
37     LEFontInstance *result = new GnomeFontInstance(fEngine, fontName, pointSize, status);
38
39     if (LE_FAILURE(status)) {
40       delete result;
41       result = NULL;
42     }
43
44     return result;
45 }