提交 b1eae5ea 编写于 作者: R Raph Levien

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
上级 3f1ea5da
......@@ -57,6 +57,9 @@ public:
void itemize(const uint16_t *string, size_t string_length, FontStyle style,
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;
private:
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 {
return mId;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册