From 89566f0ada1cafe673efa064cde38467990235d4 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Thu, 5 Jun 2014 22:40:15 -0700 Subject: Add baseFont method to FontCollection This patch adds a method to retrieve the base font from a FontCollection, which is useful when querying global font metrics. Part of the fix for bug 15467288 "Inconsistent line heights on Minikin builds" Change-Id: I268ae5128d0852a020d746bc22af81fc1a623228 --- libs/minikin/FontCollection.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libs') diff --git a/libs/minikin/FontCollection.cpp b/libs/minikin/FontCollection.cpp index 1713b47..c13670e 100644 --- a/libs/minikin/FontCollection.cpp +++ b/libs/minikin/FontCollection.cpp @@ -185,6 +185,14 @@ void FontCollection::itemize(const uint16_t *string, size_t string_size, FontSty } } +MinikinFont* FontCollection::baseFont(FontStyle style) { + if (mInstances.empty()) { + return NULL; + } + return mInstances[0].mFamily->getClosestMatch(style); +} + + uint32_t FontCollection::getId() const { return mId; } -- cgit v1.2.3