/*
 *  TnMapGlyphData.h
 *  OpenGL Map Engine
 *
 *  Created by Thant on 9/22/2010
 *  Copyright 2010 TeleNav Inc. All rights reserved.
 *
 */

#ifndef TN_MAP_GLYPH_DATA_H
#define TN_MAP_GLYPH_DATA_H

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

#include <foundation/TnTypes.h>

#include <foundation/Math/Vec.hpp>
#include <foundation/Math/Point.hpp>
#include <RenderEngine/TnImage.h>
#include <RenderEngine/TnMapGlyphInfo.h>

#include "TnMapDataRequest.h"

class TnBitmap;


/*! Engine implements this and passes an instance to the client as an
 *  argument to the asynchronous request. The client populates the
 *  data and calls the appropriate method to complete the response. */

class TnMapGlyphData : public TnMapDataRequest
{
public:
    TnMapGlyphData();

    virtual ~TnMapGlyphData();

    typedef boost::weak_ptr<TnMapGlyphData> wptr;
    typedef boost::shared_ptr<TnMapGlyphData> ptr;
    

    //! This is the UTF-8 character code of the requested
    //! glyph. Currently only precomposed glyphs are supported.

    virtual uint32_t GetCode() = 0;


    //! This is the font face. It is (will be) merely whatever is
    //! specified in the configuration file for a given feature type.

    virtual std::string const & GetFontFace() = 0;


    virtual eTnMapFontStyle GetFontFaceStyle() = 0;


    //! This is not the size of the bitmap requested. It is the point
    //! size of the font, converted to pixels assuming a given pixel
    //! density.

    virtual uint32_t GetFontSize() = 0;


    //! This is the maximum dimension expected for a provided glyph
    //! bitmap. It should be big enough for the font point size
    //! specified via the 'GetPixelSize' member function.

    virtual uint32_t GetMaxBitmapWidth() = 0;
    virtual uint32_t GetMaxBitmapHeight() = 0;


    /*! SetGlyph takes raw bytes.  Returns true if valid data was
     *! provided. Currently, it will fail in two cases:
     *!
     *!   format isn't eTnMapPixelFormat_LA 
     *!
     *!   width or height exceeds the value returned by GetMaxBitmapSize()
     *!
     *! TODO: Write converters for other pixel formats.
     *!
     */

    // Raw bytes.
    virtual bool SetGlyph(TnMapGlyphInfo::ptr const & glyphInfo,
                          TnBitmap const & glyphImage) = 0;
};

#endif

