1/*
2 ******************************************************************************
3 * © 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-2003, International Business Machines Corporation and   *
8 * others. All Rights Reserved.                                               *
9 ******************************************************************************
10 */
11
12#ifndef __FONTMAP_H
13#define __FONTMAP_H
14
15#include "layout/LETypes.h"
16#include "layout/LEScripts.h"
17#include "layout/LEFontInstance.h"
18
19#include "GUISupport.h"
20
21#define BUFFER_SIZE 128
22
23class FontMap
24{
25public:
26    FontMap(const char *fileName, le_int16 pointSize, GUISupport *guiSupport, LEErrorCode &status);
27
28    virtual ~FontMap();
29
30    virtual const LEFontInstance *getScriptFont(le_int32 scriptCode, LEErrorCode &status);
31
32    virtual le_int16 getPointSize() const;
33
34    virtual le_int32 getAscent() const;
35
36    virtual le_int32 getDescent() const;
37
38    virtual le_int32 getLeading() const;
39
40protected:
41    virtual const LEFontInstance *openFont(const char *fontName, le_int16 pointSize, LEErrorCode &status) = 0;
42
43    char errorMessage[256];
44
45private:
46    static char *strip(char *s);
47    le_int32 getFontIndex(const char *fontName);
48    void getMaxMetrics();
49
50    le_int16 fPointSize;
51    le_int32 fFontCount;
52
53    le_int32 fAscent;
54    le_int32 fDescent;
55    le_int32 fLeading;
56
57    GUISupport *fGUISupport;
58
59    const LEFontInstance *fFontInstances[scriptCodeCount];
60    const char *fFontNames[scriptCodeCount];
61    le_int32 fFontIndices[scriptCodeCount];
62};
63
64inline le_int16 FontMap::getPointSize() const
65{
66    return fPointSize;
67}
68
69#endif
70
71