diff --git a/src/text/layout.cpp b/src/text/layout.cpp index 61439739f..eb089ee86 100644 --- a/src/text/layout.cpp +++ b/src/text/layout.cpp @@ -145,11 +145,12 @@ void text_layout::shape_text(text_line_ptr line) { face_set_ptr face_set = font_manager_.get_face_set(itr->format->face_name, itr->format->fontset); face_set->set_character_sizes(itr->format->text_size); - face_ptr face = *(face_set->begin()); //TODO: Implement font sets correctly + font_face_set::iterator face_itr = face_set->begin(), face_end = face_set->end(); + for (; face_itr != face_end; face_itr++) + { + face_ptr face = *face_itr; text_shaping shaper(face->get_face()); //TODO: Make this more efficient by caching this object in font_face - line->update_max_char_height(face->get_char_height()); - shaper.process_text(text, itr->start, itr->end, itr->rtl == UBIDI_RTL, itr->script); hb_buffer_t *buffer = shaper.get_buffer(); @@ -158,6 +159,24 @@ void text_layout::shape_text(text_line_ptr line) hb_glyph_info_t *glyphs = hb_buffer_get_glyph_infos(buffer, NULL); hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer, NULL); + bool font_has_all_glyphs = true; + /* Check if all glyphs are valid. */ + for (unsigned i=0; iadd_glyph(tmp); } + line->update_max_char_height(face->get_char_height()); + break; //When we reach this point the current font had all glyphs. + } } } diff --git a/tests/visual_tests/images/hb-fontsets-800-reference.png b/tests/visual_tests/images/hb-fontsets-800-reference.png new file mode 100644 index 000000000..e6d716724 Binary files /dev/null and b/tests/visual_tests/images/hb-fontsets-800-reference.png differ diff --git a/tests/visual_tests/styles/hb-fontsets.xml b/tests/visual_tests/styles/hb-fontsets.xml new file mode 100644 index 000000000..995dfbf20 --- /dev/null +++ b/tests/visual_tests/styles/hb-fontsets.xml @@ -0,0 +1,45 @@ + + + + + My Style + + osm + ../data/points.osm + + + + + + + + + + + + + + + + diff --git a/tests/visual_tests/test.py b/tests/visual_tests/test.py index ab9190a90..2eb01a81f 100755 --- a/tests/visual_tests/test.py +++ b/tests/visual_tests/test.py @@ -46,7 +46,8 @@ files = [ {'name': "jalign-auto", 'sizes': [(200, 200)]}, {'name': "line-offset", 'sizes':[(900, 250)], 'bbox': mapnik.Box2d(-5.192, 50.189, -5.174, 50.195)}, - {'name': "orientation", 'sizes': [(800, 200)]} + {'name': "orientation", 'sizes': [(800, 200)]}, + {'name': "hb-fontsets", 'sizes': [(800, 200)]} ] def render(filename, width, height, bbox, quiet=False):