/usr/include/paragui/pgfont.h is in libparagui1.1-dev 1.1.8-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | /*
ParaGUI - crossplatform widgetset
Copyright (C) 2000,2001,2002 Alexander Pipelka
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexander Pipelka
pipelka@teleweb.at
Last Update: $Author: braindead $
Update Date: $Date: 2004/03/12 18:46:39 $
Source File: $Source: /cvsroot/paragui/paragui/include/pgfont.h,v $
CVS/RCS Revision: $Revision: 1.3.6.2.2.8 $
Status: $State: Exp $
*/
/** \file pgfont.h
Header file of the PG_Font and PG_FontEngine classes.
*/
#ifndef PG_FONT_H
#define PG_FONT_H
#include "paragui.h"
#include "pgdatacontainer.h"
#include "pgcolor.h"
#include "pgrect.h"
#include <string>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_ERRORS_H
#include FT_CACHE_H
#include FT_CACHE_IMAGE_H
#include FT_CACHE_SMALL_BITMAPS_H
#ifdef HASH_MAP_INC
#include HASH_MAP_INC
#endif
#include <map>
class PG_FontFaceCacheItem;
class PG_GlyphCacheItem;
struct PG_FontDataInternal;
/**
@short font description class
This class defines the parameters of a font (size, style, ...)
*/
class DECLSPEC PG_Font {
public:
//! Font styles
typedef enum {
NORMAL = 0x00,
BOLD = 0x01,
ITALIC = 0x02,
UNDERLINE = 0x04
} Style;
/**
Construct a PG_Font object
@param fontfile name of the fontfile to load
@param size size of the new font
@param index font index of the loaded file
*/
PG_Font(const char* fontfile, int size=14, int index=0);
/**
*/
virtual ~PG_Font();
/**
*/
int GetFontAscender();
/**
*/
int GetFontDescender();
/**
Get the absolute height of the font (in pixels)
@return height of the font
*/
int GetFontHeight();
/**
Set the color of the font
@param c PG_Color class of the new color
*/
void SetColor(const PG_Color& c);
/**
Get the current color of the font
@return PG_Color class containing the current color
*/
PG_Color GetColor();
/**
Set the transparency of the font
@param a font alpha value
*/
void SetAlpha(int a);
/**
Get the transparency of the font
@return font alpha value
*/
int GetAlpha();
/**
Set the size of the font
@param s new font size
*/
void SetSize(int s);
/**
Get the size of the font
@return current size of the font
*/
int GetSize();
/**
*/
void SetStyle(Style s);
/**
*/
Style GetStyle();
/**
Set the name (filename) of the font
@param fontfile name of the new fontfile.
@return true - on success
This function loads a new font from a file
*/
bool SetName(const char* fontfile);
/**
Get the current name of the font (filename)
@return the filename of the font
*/
const char* GetName();
void SetIndex(int index);
int GetIndex();
private:
PG_FontFaceCacheItem* GetFaceCache(int index=0);
PG_FontDataInternal* my_internaldata;
friend class PG_FontEngine;
};
/**
@author Alexander Pipelka / Ales Teska
@short C++ Encapsulation of the FreeType engine
*/
class DECLSPEC PG_FontEngine {
public:
/** */
PG_FontEngine();
/** */
~PG_FontEngine();
/**
render text onto a surface
@param Surface destination for rendered text
@param ClipRect clipping rectangle
@param BaseLineX x-startposition of the rendered text (inside the surface)
@param BaseLineY baseline of the rendered text (inside the surface)
@param Text text to render
@param ParamIn pointer to font
@return true on success
*/
static bool RenderText(SDL_Surface *Surface, const PG_Rect& ClipRect, int BaseLineX, int BaseLineY, const char *Text, PG_Font* ParamIn);
static bool RenderText(SDL_Surface *Surface, PG_Rect *ClipRect, int BaseLineX, int BaseLineY, const char *Text, PG_Font* ParamIn);
/**
*/
static bool GetTextSize(const char *Text, PG_Font* ParamIn, Uint16 *Width = NULL, Uint16 *Height = NULL, int *BaselineY = NULL, int *FontLineSkip = NULL, Uint16 *FontHeight = NULL, int *Ascent = NULL, int *Descent = NULL);
protected:
/**
*/
static bool BlitFTBitmap(SDL_Surface *Surface, FT_Bitmap *Bitmap, int PosX, int PosY, PG_Font* Param, PG_Rect *ClipRect);
/**
*/
static void FontEngineError(FT_Error error);
private:
/**
Load a font face from the archive
@param filename fontfile to load (truetype)
@param fontsize size of the face in pixels
@return pointer to the loaded PG_FontFaceCacheItem
*/
static PG_FontFaceCacheItem* LoadFontFace(const char* filename, FT_F26Dot6 fontsize, int index = 0);
/**
*/
static PG_GlyphCacheItem* GetGlyph(PG_Font *Param, int glyph_index);
typedef std::map<FT_F26Dot6, PG_FontFaceCacheItem*> MAP_SUBITEMS;
class FONT_ITEM {
public:
FONT_ITEM() : memdata(NULL) {
};
virtual ~FONT_ITEM();
std::string name;
PG_DataContainer* memdata;
MAP_SUBITEMS subitems;
};
typedef std::map<std::string, FONT_ITEM*> MAP_FONTS;
static MAP_FONTS my_fontcache;
static FT_Library my_library;
friend class PG_Font;
};
#endif
|