/*
 *  TnMapGlyphInfo.h
 *  OpenGL Map Engine
 *
 *  Created by Thant on 1/20/2014
 *  Copyright 2014 TeleNav Inc. All rights reserved.
 *
 */

#ifndef TN_MAP_GLYPH_INFO_H
#define TN_MAP_GLYPH_INFO_H

#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <string>

#include <foundation/TnTypes.h>
#include <foundation/Math/Vec.hpp>
#include <foundation/Math/Point.hpp>

#include "TnMapStyleParams.h"


struct TnMapGlyphInfo
{
    // For safety. Initialize everything to zero.
    TnMapGlyphInfo() : code(0), index(0), fontSize(0), faceStyle(eTnMapFontStyle_Normal) {}

    typedef boost::shared_ptr<TnMapGlyphInfo> ptr;

    uint32_t code;
    uint32_t index;
    uint32_t fontSize;
    std::string face;
    eTnMapFontStyle faceStyle;

    // These are in pixel coordinates (will be points)

    /*! Origin is the glyph box origin. The y component typically
     *  corresponds to the baseline and the x component typically
     *  corresponds to the left side of the glyph bitmap (which is not
     *  the edge of the bounding box).
     */
    Tn::math::Point2f origin;

    /*! Advance is how much to move the cursor to render the next
     *  character. Currently only the horizontal component is used.
     */
    Tn::math::Vec2f advance;

    /*! Center is the coordinate in the glyph corresponding to the
     *  centerline of a string of text. Used when the desire is to
     *  center text on a spline instead of using the spline as a base
     *  line. Currently only the vertical component is used.
     */
    Tn::math::Point2f center;

    /*! The key of map is the index of a glyph which is the right-hand glyph in kerning pair.
     *  the value of map is the kerning amount between this glyph(left-hand glyph) described by glyph info and the right-hand glyph.
     *  E.g. glyph_info.index: 65(A) 
     *       glyph_info.kerningMap[101(e)]: (-2,0)" means the horizontal kerning amount is -2
     *  the vertical kerning amount is 0 while 'e' is rendered next to the 'A'
     */
    std::map<uint32_t, Tn::math::Vec2i> kerningMap;
};

#endif

