Skip to content

Commit c56c671

Browse files
goderbauerjungshik
authored andcommitted
Reduce size of Flutter config even more
Uncompressed size: 883,280B (862.6 KB), minus 363.2KB Compressed size: 460,972B (450.2KB), minus 83.9KB The following unused resources are removed: * uts46.nrm * nfkc_cf.nrm * cnvalias.icu * Break Iterators for: * Sentence breaks * Title breaks * CSS-specific line breaks ("regular" line breaks are still supported) Change-Id: I26f932b2e991f44c6d86fe9858724d34c5c323b7 Reviewed-on: https://chromium-review.googlesource.com/1162775 Reviewed-by: Jungshik Shin <jshin@chromium.org> Reviewed-by: Greg Spencer <gspencer@google.com>
1 parent a191af9 commit c56c671

File tree

6 files changed

+105
-1
lines changed

6 files changed

+105
-1
lines changed

flutter/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ICU Data for Flutter
2+
3+
This directory contains the minimal ICU data configuration for the Flutter
4+
framework (https://flutter.io). It is based on Chromium's iOS configuration
5+
(see `../ios`) with additional data stripped out to reduce size:
6+
7+
* All resources mentioned in `flutter-removed-resources.txt` are stripped out.
8+
* Additionally, `brkitr.patch` removes the break iterators for sentence and
9+
title breaks as well as the CSS specific line break iterators.
10+
11+
## Included Resources
12+
13+
* Break iterators (and related dictionaries) for:
14+
* Characters
15+
* Words
16+
* Lines
17+
* Unicode Normalization Form KC (NFKC)
18+
* Likely Subtags
19+
20+
21+
## Known Issues
22+
23+
* https://github.com/flutter/flutter/issues/19584

flutter/brkitr.patch

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
diff --git a/source/data/brkitr/brklocal.mk b/source/data/brkitr/brklocal.mk
2+
index ea12e27f..462a2551 100644
3+
--- a/source/data/brkitr/brklocal.mk
4+
+++ b/source/data/brkitr/brklocal.mk
5+
@@ -39,14 +39,11 @@ BRK_DICT_SOURCE = burmesedict.txt khmerdict.txt laodict.txt\
6+
7+
8+
# List of break iterator files (brk).
9+
-BRK_SOURCE = char.txt line.txt\
10+
- line_normal.txt line_normal_cj.txt line_normal_fi.txt\
11+
- line_loose_cj.txt\
12+
- sent.txt sent_el.txt title.txt word.txt word_ja.txt
13+
+BRK_SOURCE = char.txt\
14+
+ line_normal.txt line_normal_fi.txt\
15+
+ word.txt word_ja.txt
16+
17+
18+
# Ordinary resources
19+
-BRK_RES_SOURCE = de.txt el.txt en.txt en_US.txt\
20+
- es.txt fi.txt fr.txt it.txt ja.txt\
21+
- pt.txt ru.txt zh.txt zh_Hant.txt
22+
+BRK_RES_SOURCE =fi.txt ja.txt
23+
24+
diff --git a/source/data/brkitr/fi.txt b/source/data/brkitr/fi.txt
25+
index 72029ee4..633862a7 100644
26+
--- a/source/data/brkitr/fi.txt
27+
+++ b/source/data/brkitr/fi.txt
28+
@@ -4,8 +4,5 @@ fi{
29+
Version{"2.1.19.14"}
30+
boundaries{
31+
line:process(dependency){"line_normal_fi.brk"}
32+
- line_loose:process(dependency){"line_normal_fi.brk"}
33+
- line_normal:process(dependency){"line_normal_fi.brk"}
34+
- line_strict:process(dependency){"line_normal_fi.brk"}
35+
}
36+
}
37+
diff --git a/source/data/brkitr/ja.txt b/source/data/brkitr/ja.txt
38+
index cb732a76..73ebc6f8 100644
39+
--- a/source/data/brkitr/ja.txt
40+
+++ b/source/data/brkitr/ja.txt
41+
@@ -4,9 +4,6 @@ ja{
42+
Version{"2.1.29.25"}
43+
boundaries{
44+
line:process(dependency){"line_normal.brk"}
45+
- line_loose:process(dependency){"line_loose_cj.brk"}
46+
- line_normal:process(dependency){"line_normal_cj.brk"}
47+
- line_strict:process(dependency){"line.brk"}
48+
word:process(dependency){"word_ja.brk"}
49+
}
50+
}
51+
diff --git a/source/data/brkitr/root.txt b/source/data/brkitr/root.txt
52+
index f1fa4e08..4071947a 100644
53+
--- a/source/data/brkitr/root.txt
54+
+++ b/source/data/brkitr/root.txt
55+
@@ -5,11 +5,6 @@ root{
56+
boundaries{
57+
grapheme:process(dependency){"char.brk"}
58+
line:process(dependency){"line_normal.brk"}
59+
- line_loose:process(dependency){"line_normal.brk"}
60+
- line_normal:process(dependency){"line_normal.brk"}
61+
- line_strict:process(dependency){"line.brk"}
62+
- sentence:process(dependency){"sent.brk"}
63+
- title:process(dependency){"title.brk"}
64+
word:process(dependency){"word.brk"}
65+
}
66+
dictionaries{

flutter/flutter-removed-resources.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,9 @@ timezoneTypes.res
388388
windowsZones.res
389389
zoneinfo64.res
390390

391-
# *.cnv
391+
# mappings/*
392392
big5-html.cnv
393+
cnvalias.icu
393394
euc-jp-html.cnv
394395
euc-kr-html.cnv
395396
gb18030.cnv
@@ -425,3 +426,5 @@ x-mac-cyrillic-html.cnv
425426

426427
# other
427428
confusables.cfu
429+
uts46.nrm
430+
nfkc_cf.nrm

flutter/icudtl.dat

-363 KB
Binary file not shown.

flutter/patch_brkitr.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
# Copyright (c) 2018 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
treeroot="$(dirname "$0")/.."
7+
cd "${treeroot}"
8+
9+
echo "Applying brkitr.patch"
10+
patch -p1 < flutter/brkitr.patch || { echo "failed to patch" >&2; exit 1; }

scripts/make_data_all.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ $ICUROOT/scripts/copy_data.sh android
1616
$ICUROOT/ios/patch_locale.sh
1717
$ICUROOT/scripts/make_data.sh
1818
$ICUROOT/scripts/copy_data.sh ios
19+
$ICUROOT/flutter/patch_brkitr.sh
20+
$ICUROOT/scripts/make_data.sh
1921
$ICUROOT/scripts/copy_data.sh flutter
2022
$ICUROOT/scripts/clean_up_data_source.sh
2123

0 commit comments

Comments
 (0)