X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbuilders%2Ffont.cpp;h=4fb643527c83d9ea43058ffb81ead0332a74941e;hp=44ffafa176142300c2e0eb07aab74290541bd904;hb=ae45c0397e2cb8f0a01f2f31d01c95ff3870271e;hpb=866c80e19e66d6dd8d49ec48d9be54a3a7fe07a2 diff --git a/source/builders/font.cpp b/source/builders/font.cpp index 44ffafa1..4fb64352 100644 --- a/source/builders/font.cpp +++ b/source/builders/font.cpp @@ -1,7 +1,6 @@ #include #include #include -#include "gl.h" #include "font.h" #include "primitivebuilder.h" #include "texture2d.h" @@ -50,7 +49,7 @@ float Font::get_string_width(const string &str, StringCodec::Decoder &dec) const float x = 0; unsigned prev = 0; - for(string::const_iterator i=str.begin(); i!=str.end();) + for(auto i=str.begin(); i!=str.end();) { unsigned c = dec.decode_char(str, i); if(prev) @@ -68,7 +67,7 @@ void Font::build_string(const string &str, StringCodec::Decoder &dec, PrimitiveB unsigned prev = 0; unsigned next = 0; - for(string::const_iterator i=str.begin(); (next || i!=str.end());) + for(auto i=str.begin(); (next || i!=str.end());) { unsigned c = (next ? next : dec.decode_char(str, i)); next = (i!=str.end() ? dec.decode_char(str, i) : 0); @@ -79,7 +78,7 @@ void Font::build_string(const string &str, StringCodec::Decoder &dec, PrimitiveB next = 0; } - GlyphMap::const_iterator j = glyphs.find(c); + auto j = glyphs.find(c); if(j==glyphs.end()) continue; @@ -107,7 +106,7 @@ void Font::create_glyph_quad(const Glyph &glyph, PrimitiveBuilder &bld) const float Font::get_glyph_advance(unsigned code, unsigned next) const { - GlyphMap::const_iterator i = glyphs.find(code); + auto i = glyphs.find(code); if(i==glyphs.end()) return 0; @@ -115,7 +114,7 @@ float Font::get_glyph_advance(unsigned code, unsigned next) const if(next) { - KerningMap::const_iterator j = kerning.find(CodePair(code, next)); + auto j = kerning.find(CodePair(code, next)); if(j!=kerning.end()) advance += j->second; } @@ -125,7 +124,7 @@ float Font::get_glyph_advance(unsigned code, unsigned next) const unsigned Font::get_ligature(unsigned code, unsigned next) const { - LigatureMap::const_iterator i = ligatures.find(CodePair(code, next)); + auto i = ligatures.find(CodePair(code, next)); return (i!=ligatures.end() ? i->second : 0); } @@ -144,19 +143,8 @@ Font::Glyph::Glyph(): { } -Font::Loader::Loader(Font &f): - DataFile::CollectionObjectLoader(f, 0) -{ - init(); -} - Font::Loader::Loader(Font &f, Collection &c): DataFile::CollectionObjectLoader(f, &c) -{ - init(); -} - -void Font::Loader::init() { add("native_size", &Font::native_size); add("ascent", &Font::ascent);