-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathWindowsTextLayoutManager.h
More file actions
69 lines (57 loc) · 2.54 KB
/
WindowsTextLayoutManager.h
File metadata and controls
69 lines (57 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#pragma warning(push)
#pragma warning(disable : 5028) // 'Node': Alignment specified in prior declaration (1) not specified in definition
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
#pragma warning(pop)
#include <react/renderer/attributedstring/AttributedStringBox.h>
#include <react/renderer/attributedstring/ParagraphAttributes.h>
#include <react/renderer/core/LayoutConstraints.h>
#include <react/renderer/textlayoutmanager/TextLayoutContext.h>
#include <react/renderer/textlayoutmanager/TextMeasureCache.h>
#include <react/utils/ContextContainer.h>
#include <memory>
namespace facebook::react {
class WindowsTextLayoutManager : public TextLayoutManager {
public:
WindowsTextLayoutManager(const ContextContainer::Shared &contextContainer);
virtual ~WindowsTextLayoutManager() = default;
/*
* Not copyable.
*/
WindowsTextLayoutManager(const WindowsTextLayoutManager &) = delete;
WindowsTextLayoutManager &operator=(const WindowsTextLayoutManager &) = delete;
/*
* Not movable.
*/
WindowsTextLayoutManager(WindowsTextLayoutManager &&) = delete;
WindowsTextLayoutManager &operator=(WindowsTextLayoutManager &&) = delete;
static void GetTextLayout(
const AttributedStringBox &attributedStringBox,
const ParagraphAttributes ¶graphAttributes,
Size size,
winrt::com_ptr<IDWriteTextLayout> &spTextLayout,
TextMeasurement::Attachments &attachments) noexcept;
static void GetTextLayout(
const AttributedStringBox &attributedStringBox,
const ParagraphAttributes ¶graphAttributes,
LayoutConstraints layoutConstraints,
winrt::com_ptr<IDWriteTextLayout> &spTextLayout) noexcept;
static void GetTextLayoutByAdjustingFontSizeToFit(
AttributedStringBox attributedStringBox,
const ParagraphAttributes ¶graphAttributes,
LayoutConstraints layoutConstraints,
winrt::com_ptr<IDWriteTextLayout> &spTextLayout,
TextMeasurement::Attachments &attachments,
float minimumFontScale) noexcept;
private:
static winrt::hstring GetTransformedText(const AttributedStringBox &attributedStringBox);
static DWRITE_READING_DIRECTION GetNaturalReadingDirection(const AttributedStringBox &attributedStringBox) noexcept;
static void GetTextLayout(
const AttributedStringBox &attributedStringBox,
const ParagraphAttributes ¶graphAttributes,
Size size,
winrt::com_ptr<IDWriteTextLayout> &spTextLayout) noexcept;
};
} // namespace facebook::react