Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 :
23 : #ifndef MUSE_DRAW_IFONTPROVIDER_H
24 : #define MUSE_DRAW_IFONTPROVIDER_H
25 :
26 : #include <memory>
27 :
28 : #include "global/modularity/imoduleinterface.h"
29 : #include "global/io/path.h"
30 : #include "global/io/iodevice.h"
31 : #include "global/types/string.h"
32 :
33 : #include "types/font.h"
34 : #include "types/geometry.h"
35 :
36 : namespace muse::draw {
37 : class IFontProvider : MODULE_GLOBAL_INTERFACE
38 : {
39 666568 : INTERFACE_ID(muse::draw::IFontProvider)
40 :
41 : public:
42 62 : virtual ~IFontProvider() = default;
43 :
44 : virtual int addSymbolFont(const String& family, const io::path_t& path) = 0;
45 : virtual int addSymbolFont(const String& family, std::shared_ptr<io::IODevice> device) = 0;
46 :
47 : virtual double lineSpacing(const Font& f) const = 0;
48 : virtual double xHeight(const Font& f) const = 0;
49 : virtual double height(const Font& f) const = 0;
50 : virtual double capHeight(const Font& f) const = 0;
51 : virtual double ascent(const Font& f) const = 0;
52 : virtual double descent(const Font& f) const = 0;
53 :
54 : virtual double underlinePos(const Font& f) const = 0;
55 : virtual double lineWidth(const Font& f) const = 0;
56 : virtual double strikeOutPos(const Font& f) const = 0;
57 :
58 : virtual bool inFont(const Font& f, char32_t ucs4) const = 0;
59 :
60 : // Text
61 : virtual double horizontalAdvance(const Font& f, const String& string) const = 0;
62 : virtual double horizontalAdvance(const Font& f, char32_t ucs4) const = 0;
63 :
64 : virtual RectF boundingRect(const Font& f, const String& string) const = 0;
65 : virtual RectF boundingRect(const Font& f, char32_t ucs4) const = 0;
66 :
67 : virtual RectF tightBoundingRect(const Font& f, const String& string) const = 0;
68 : };
69 : }
70 :
71 : #endif // MUSE_DRAW_IFONTPROVIDER_H
|