<p dir="auto">We use expat to parse the Android fonts XML file. We could hand-roll a parser that is just enough to read the shipped fonts.xml files that would be both faster and smaller than expat.</p>
<p dir="auto">Expat is used by Skia for parsing font manifests on Android exclusively.  In the latest build it takes up about 65kb uncompressed (<a href="https://storage.googleapis.com/flutter_infra/flutter/5a4bd0de69fbceb36ccecfcbf8c81dc8d94ea949/android-arm64-release/sizes/index.html" rel="nofollow">https://storage.googleapis.com/flutter_infra/flutter/5a4bd0de69fbceb36ccecfcbf8c81dc8d94ea949/android-arm64-release/sizes/index.html</a>).</p>
<p dir="auto">We should verify that it's not getting bundled into non-Android builds (I believe it's not but it's been a while since I've checked). We should also explore whether we could slim this down - i.e. by using a different XML parsing implementation that may be smaller, or by using JNI to get the data instead.  Relevant part of Skia is: <a href="https://github.com/google/skia/blob/master/src/ports/SkFontMgr_android_parser.cpp">https://github.com/google/skia/blob/master/src/ports/SkFontMgr_android_parser.cpp</a> - some BUILD info would have to change as well to make this work in Skia.</p>
<p dir="auto">Related bug: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="492018515" data-permission-text="Title is private" data-url="https://github.com/flutter/flutter/issues/40220" data-hovercard-type="issue" data-hovercard-url="/flutter/flutter/issues/40220/hovercard" href="https://github.com/flutter/flutter/issues/40220">#40220</a></p>
<p dir="auto">This would have the added benefit of resolving the expat portion of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="487221574" data-permission-text="Title is private" data-url="https://github.com/flutter/flutter/issues/39532" data-hovercard-type="issue" data-hovercard-url="/flutter/flutter/issues/39532/hovercard" href="https://github.com/flutter/flutter/issues/39532">#39532</a></p>
<p dir="auto">/cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/xster/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/xster">@xster</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/chinmaygarde/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/chinmaygarde">@chinmaygarde</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/matthew-carroll/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/matthew-carroll">@matthew-carroll</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mklim/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mklim">@mklim</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jason-simmons/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jason-simmons">@jason-simmons</a></p>