OpenTTD Source: src/gfx_layout_icu.h Source File

OpenTTD Source 15.0-RC2

gfx_layout_icu.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef GFX_LAYOUT_ICU_H
11#define GFX_LAYOUT_ICU_H
12
13#include "gfx_layout.h"
14
15#include <unicode/brkiter.h>
16#include <unicode/ustring.h>
17
21 class ICUParagraphLayoutFactory {
22public:
24 typedef UChar CharType;
26 static const bool SUPPORTS_RTL = true;
27
28 static std::unique_ptr<ParagraphLayouter> GetParagraphLayout(UChar *buff, UChar *buff_end, FontMap &font_mapping);
29 static size_t AppendToBuffer(UChar *buff, const UChar *buffer_last, char32_t c);
30
31 static void InitializeLayouter();
32 static std::unique_ptr<icu::BreakIterator> GetBreakIterator();
33private:
34 static std::unique_ptr<icu::BreakIterator> break_iterator;
35};
36
37#endif /* GFX_LAYOUT_ICU_H */
ICUParagraphLayoutFactory
Helper class to construct a new ICUParagraphLayout.
Definition gfx_layout_icu.h:21
ICUParagraphLayoutFactory::GetBreakIterator
static std::unique_ptr< icu::BreakIterator > GetBreakIterator()
Get a thread-safe line break iterator.
Definition gfx_layout_icu.cpp:397
ICUParagraphLayoutFactory::CharType
UChar CharType
Helper for GetLayouter, to get the right type.
Definition gfx_layout_icu.h:24
ICUParagraphLayoutFactory::InitializeLayouter
static void InitializeLayouter()
Initialize data needed for the ICU layouter.
Definition gfx_layout_icu.cpp:385
ICUParagraphLayoutFactory::SUPPORTS_RTL
static const bool SUPPORTS_RTL
Helper for GetLayouter, to get whether the layouter supports RTL.
Definition gfx_layout_icu.h:26
gfx_layout.h
Functions related to laying out the texts.
FontMap
std::vector< std::pair< int, Font * > > FontMap
Mapping from index to font.
Definition gfx_layout.h:106