-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchromium-118-use_system_freetype.patch
91 lines (81 loc) · 3.73 KB
/
chromium-118-use_system_freetype.patch
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
commit ed354d00aeda84693611b14baa56a287557a26b5
Author: Munira Tursunova <[email protected]>
Date: Tue Sep 12 11:54:48 2023 +0000
Add check for use_system_freetype when importing private freetype header
In [0] the include of private freetype header was added, which caused
build breakage when use_system_freetype=true, see [1].
This CL fixes the breakage by introducing USE_SYSTEM_FREETYPE build flag.
[0] https://chromium-review.googlesource.com/c/chromium/src/+/4717485
[1] https://chromium-review.googlesource.com/c/chromium/src/+/4717485/comments/cdfca7b9_8e61b2e0
Bug: 1429581
Change-Id: I7f7de4cdb2dc46092a91a47d766bedb58ddccb7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4843428
Commit-Queue: Munira Tursunova <[email protected]>
Reviewed-by: Dominik Röttsches <[email protected]>
Reviewed-by: Rick Byers <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1195323}
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 7b086f95413ff..4ce797ebad722 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/buildflag_header.gni")
import("//build/config/features.gni")
import("//build/config/freetype/freetype.gni")
import("//third_party/harfbuzz-ng/harfbuzz.gni")
@@ -65,3 +66,8 @@ component("freetype_harfbuzz") {
public_deps += [ "//third_party/harfbuzz-ng:harfbuzz_source" ]
}
}
+
+buildflag_header("freetype_buildflags") {
+ header = "freetype_buildflags.h"
+ flags = [ "USE_SYSTEM_FREETYPE=$use_system_freetype" ]
+}
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn
index 591d2f939605b..f6a2cd2168d1e 100644
--- a/third_party/blink/renderer/platform/BUILD.gn
+++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1717,6 +1717,7 @@ component("platform") {
"//services/viz/public/cpp/gpu",
"//skia",
"//skia:skcms",
+ "//third_party:freetype_buildflags",
"//third_party:freetype_harfbuzz",
"//third_party/abseil-cpp:absl",
"//third_party/blink/public:image_resources",
diff --git a/third_party/blink/renderer/platform/fonts/simple_font_data.cc b/third_party/blink/renderer/platform/fonts/simple_font_data.cc
index abe06f35c14a5..b2bfd88f0d85d 100644
--- a/third_party/blink/renderer/platform/fonts/simple_font_data.cc
+++ b/third_party/blink/renderer/platform/fonts/simple_font_data.cc
@@ -48,7 +48,7 @@
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/character_names.h"
#include "third_party/blink/renderer/platform/wtf/text/unicode.h"
-#include "third_party/freetype/src/src/autofit/afws-decl.h"
+#include "third_party/freetype_buildflags.h"
#include "third_party/skia/include/core/SkFontMetrics.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkTypeface.h"
@@ -57,12 +57,22 @@
#include "ui/gfx/geometry/skia_conversions.h"
#include "v8/include/v8.h"
+#if !BUILDFLAG(USE_SYSTEM_FREETYPE)
+#include "third_party/freetype/src/src/autofit/afws-decl.h"
+#endif
+
namespace blink {
constexpr float kSmallCapsFontSizeMultiplier = 0.7f;
constexpr float kEmphasisMarkFontSizeMultiplier = 0.5f;
+
+#if !BUILDFLAG(USE_SYSTEM_FREETYPE)
constexpr int32_t kFontObjectsMemoryConsumption =
std::max(sizeof(AF_LatinMetricsRec), sizeof(AF_CJKMetricsRec));
+#else
+// sizeof(AF_LatinMetricsRec) = 2128
+constexpr int32_t kFontObjectsMemoryConsumption = 2128;
+#endif
SimpleFontData::SimpleFontData(const FontPlatformData& platform_data,
scoped_refptr<CustomFontData> custom_data,