From eacde4fe436f0b3ed8f6e1bc445dd6e0b877d895 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 21 Jul 2014 12:41:31 +0100 Subject: [PATCH] remove dummy_shaper --- include/mapnik/text/dummy_shaper.hpp | 93 ---------------------------- include/mapnik/text/layout.hpp | 2 - src/text/layout.cpp | 4 +- 3 files changed, 2 insertions(+), 97 deletions(-) delete mode 100644 include/mapnik/text/dummy_shaper.hpp diff --git a/include/mapnik/text/dummy_shaper.hpp b/include/mapnik/text/dummy_shaper.hpp deleted file mode 100644 index 3d0827cbc..000000000 --- a/include/mapnik/text/dummy_shaper.hpp +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** - * - * This file is part of Mapnik (c++ mapping toolkit) - * - * Copyright (C) 2013 Artem Pavlenko - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - *****************************************************************************/ - -#ifndef MAPNIK_DUMMY_SHAPER_HPP -#define MAPNIK_DUMMY_SHAPER_HPP - -// mapnik -#include -#include -#include -// stl -#include - -namespace mapnik -{ - -struct dummy_shaper -{ - -/* Dummy shaping limitations: - * - LTR text only - * - Only first font in fontset is used - * - No kerning - * - No complex scripts - */ - -static void shape_text(text_line & line, - text_itemizer & itemizer, - std::map & width_map, - face_manager_freetype & font_manager, - double scale_factor ) -{ - unsigned start = line.first_char(); - unsigned end = line.last_char(); - mapnik::value_unicode_string const& text = itemizer.text(); - size_t length = end - start; - if (!length) return; - line.reserve(length); - std::list const& list = itemizer.itemize(start, end); - - for (auto const& text_item : list) - { - face_set_ptr face_set = font_manager.get_face_set(text_item.format->face_name, text_item.format->fontset); - double size = text_item.format->text_size * scale_factor; - face_set->set_unscaled_character_sizes(); - if (face_set->begin() == face_set->end()) return; // Invalid face set - face_ptr face = *(face_set->begin()); - FT_Face freetype_face = face->get_face(); - - for (unsigned i = text_item.start; i < text_item.end; ++i) - { - UChar32 c = text.char32At(i); - glyph_info tmp; - tmp.glyph_index = FT_Get_Char_Index(freetype_face, c); - if (tmp.glyph_index == 0) continue; // Skip unknown characters - face->glyph_dimensions(tmp); - - tmp.char_index = i; - tmp.face = face; - tmp.format = text_item.format; - tmp.scale_multiplier = size / face->get_face()->units_per_EM; - tmp.offset.clear(); - width_map[i] += tmp.advance(); - line.add_glyph(std::move(tmp), scale_factor); - } - line.update_max_char_height(face->get_char_height(size)); - } -} - -}; - -} // namespace mapnik - -#endif // MAPNIK_DUMMY_SHAPER_HPP diff --git a/include/mapnik/text/layout.hpp b/include/mapnik/text/layout.hpp index 67aa584ba..bb625c852 100644 --- a/include/mapnik/text/layout.hpp +++ b/include/mapnik/text/layout.hpp @@ -28,8 +28,6 @@ #include #include #include -#include -#include #include //stl diff --git a/src/text/layout.cpp b/src/text/layout.cpp index 8c4e5be27..51d38c510 100644 --- a/src/text/layout.cpp +++ b/src/text/layout.cpp @@ -220,8 +220,8 @@ void text_layout::clear() itemizer_.clear(); lines_.clear(); width_map_.clear(); - width_ = 0.; - height_ = 0.; + width_ = 0.0; + height_ = 0.0; child_layout_list_.clear(); }