mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This is 2nd attempt at I9e01d237c9adcb05e200932401cb1a4780049f86. The previous CL was reverted because 8-bit integers were too small to store the indices of mFamilyVec. This CL changes it to 16-bit integers since size_t is still unnecessary large. Theoretically, 32-bit integers are necessary for the indices of mFamilyVec since the size of mFamilyVec can be 0x10EE01. However, in practice, 16-bit integers are enough for the indices of mFamilyVec. The length of mFamilyVec for the system fonts is 2084. Even if the developers load their own very large fonts, it can only increase the number of elements in mFamilyVec to at most 0x10FF. As the result, memory usage of the FontCollections for the system fonts decreases as follows. 64-bit process: before: 398,264 bytes, after: 282,568 bytes (-115,696 bytes) 32-bit process: before: 199,132 bytes, after: 149,548 bytes (-49,584 bytes) Bug: 33562608 Test: Verified Emoji and CJK characters are present. Test: android.text.cts.EmojiTest passed Test: Minikin unit tests passed Change-Id: I6796fd55ac30fe30528a212ebf6097b1d672e2f8