Correct name of def font on Android and fix bug with coords-to-glyphpos method.
Change-Id: Ib9d2a0a1a54f14c4725e47e00fb547df0a91cd40
This commit is contained in:
@@ -21,7 +21,7 @@ config("txt_config") {
|
||||
}
|
||||
|
||||
source_set("txt") {
|
||||
if (current_toolchain == host_toolchain) {
|
||||
if (current_toolchain == host_toolchain && !is_mac) {
|
||||
defines = [ "DIRECTORY_FONT_MANAGER_AVAILABLE" ]
|
||||
}
|
||||
if (is_android) {
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
#define LIB_TXT_SRC_FONT_COLLECTION_H_
|
||||
|
||||
#define DEFAULT_FAMILY_NAME "Roboto"
|
||||
#ifdef ANDROID_FONT_MANAGER_AVAILABLE
|
||||
#undef DEFAULT_FAMILY_NAME
|
||||
// On Android, Roboto is called 'sans-serif'
|
||||
#define DEFAULT_FAMILY_NAME "sans-serif"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_CACHE_CAPACITY 20
|
||||
|
||||
#include <list>
|
||||
|
||||
@@ -842,12 +842,10 @@ size_t Paragraph::GetGlyphPositionAtCoordinate(
|
||||
prev_count = 0;
|
||||
for (size_t x_index = 1; x_index < glyph_position_x_[y_index].size() - 1;
|
||||
++x_index) {
|
||||
// TODO(garyq): Resolve edge case where second to last glyph position is
|
||||
// skipped/unreachable.
|
||||
if (dx < glyph_position_x_[y_index][x_index] -
|
||||
(using_glyph_center_as_boundary
|
||||
? (glyph_position_x_[y_index][x_index + 1] -
|
||||
glyph_position_x_[y_index][x_index]) /
|
||||
? (glyph_position_x_[y_index][x_index] -
|
||||
glyph_position_x_[y_index][x_index -1]) /
|
||||
2.0f
|
||||
: 0)) {
|
||||
break;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
namespace txt {
|
||||
|
||||
TEST_F(RenderTest, SimpleParagraph) {
|
||||
const char* text = "Hello World";
|
||||
const char* text = "Hello World Text Dialog";
|
||||
auto icu_text = icu::UnicodeString::fromUTF8(text);
|
||||
std::u16string u16_text(icu_text.getBuffer(),
|
||||
icu_text.getBuffer() + icu_text.length());
|
||||
@@ -39,6 +39,7 @@ TEST_F(RenderTest, SimpleParagraph) {
|
||||
|
||||
txt::TextStyle text_style;
|
||||
text_style.color = SK_ColorBLACK;
|
||||
text_style.font_size = 12;
|
||||
builder.PushStyle(text_style);
|
||||
builder.AddText(u16_text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user