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
This commit is contained in:
@@ -57,6 +57,9 @@ public:
|
|||||||
void itemize(const uint16_t *string, size_t string_length, FontStyle style,
|
void itemize(const uint16_t *string, size_t string_length, FontStyle style,
|
||||||
std::vector<Run>* result) const;
|
std::vector<Run>* result) const;
|
||||||
|
|
||||||
|
// Get the base font for the given style, useful for font-wide metrics.
|
||||||
|
MinikinFont* baseFont(FontStyle style);
|
||||||
|
|
||||||
uint32_t getId() const;
|
uint32_t getId() const;
|
||||||
private:
|
private:
|
||||||
static const int kLogCharsPerPage = 8;
|
static const int kLogCharsPerPage = 8;
|
||||||
|
|||||||
@@ -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 {
|
uint32_t FontCollection::getId() const {
|
||||||
return mId;
|
return mId;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user