Files
Webcam/include/framework/font/font_interface.h
2026-06-22 11:49:35 +02:00

61 lines
1.6 KiB
C++

/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __FONTINTERFACE__
#define __FONTINTERFACE__
#include "color/color.h"
#include "geometry/rect.h"
#include "memory/nshared_ptr.h"
#include "nstring/nstring.h"
namespace GS {
class Picture;
/*!
@short Font interface.
@author Emmanuel Julien (ejulien@owloh.com)
*/
struct IFont : public SharedObject
{
/// Return the font name.
virtual const char *GetName() const = 0;
/// Return the bounding rect for a given string.
virtual iRect GetTextBoundRect(const char *) const = 0;
/// Set font size in pixels.
virtual bool SetPixelSize(int) = 0;
/// Get font height in pixels.
virtual int GetHeight() const = 0;
/// Get font current glyph advance.
virtual int GetAdvance() const = 0;
/// Return true if the font supports kerning.
virtual bool HasKerning() const = 0;
/// Return the kerning for a glyph codepoint.
virtual int GetKerning(uint previous_codepoint, uint codepoint) const = 0;
/// Load the glyph corresponding to a UTF-32 codepoint.
virtual bool LoadGlyph(uint codepoint, bool for_render) = 0;
/// Render currently loaded glyph to a picture.
virtual bool RenderCurrentGlyph(Picture &picture, const iPoint &position, const iRect &clip, const Color &color = Color::White) = 0;
/// Set a fallback font to query in case a glyph cannot be found in this font.
virtual void SetFallback(IFont *) {}
virtual ~IFont() {}
};
typedef SharedPtr <IFont> sIFont;
} // GS
#endif // __FONTINTERFACE__