SUMO - Simulation of Urban MObility
polyfonts.c File Reference
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <GL/gl.h>
#include "polyfonts.h"
#include "pfPSansBold16.h"
Include dependency graph for polyfonts.c:

Go to the source code of this file.

Data Structures

struct  nameValue
 
struct  vertex
 

Macros

#define abs(a)   (((a)<0) ? -(a) : (a))
 
#define DtoR   (PI/180.0)
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define numWeights   (sizeof(weightOffset) / sizeof(vertex))
 
#define PI   (3.1415926535897932384626433)
 
#define RtoD   (180.0/PI)
 
#define sign(a)   (((a)<0) ? -1 : (a)>0 ? 1 : 0)
 
#define unfix(value)   ((SUMOReal)(value)) / ((SUMOReal)pfFixScale)
 

Functions

static int comp (const void *key, const void *target)
 
static int drawWideChar (wchar_t c)
 
static SUMOReal getCharAdvance (wchar_t c)
 
static int getCharBBox (wchar_t c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy)
 
static int getStringBox (char *c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy)
 
static int getStringBoxW (wchar_t *c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy)
 
static int lookupGlOp (char *op)
 
SUMOReal pfdkGetStringWidth (const char *c)
 
int pfDrawChar (wchar_t c)
 
int pfDrawString (const char *c)
 
int pfDrawStringW (wchar_t *c)
 
static pfglyphpfFindGlyph (pfglyph *glyphs, int numglyphs, pfglyph *find)
 
wchar_t pfGetChar (int g)
 
SUMOReal pfGetCharAdvance (wchar_t c)
 
SUMOReal pfGetCharAscent (wchar_t c)
 
int pfGetCharBBox (wchar_t c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy)
 
SUMOReal pfGetCharDescent (wchar_t c)
 
SUMOReal pfGetCharHeight (wchar_t c)
 
SUMOReal pfGetCharWidth (wchar_t c)
 
pffontpfGetCurrentFont ()
 
SUMOReal pfGetFontAscent ()
 
int pfGetFontBBox (SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy)
 
SUMOReal pfGetFontDescent ()
 
SUMOReal pfGetFontHeight ()
 
char * pfGetFontName ()
 
int pfGetFontNumGlyphs ()
 
SUMOReal pfGetFontWidth ()
 
static pfglyphpfGetGlyph (wchar_t c)
 
void pfGetPosition (SUMOReal *x, SUMOReal *y)
 
void pfSetAngleD (SUMOReal a)
 
void pfSetAngleR (SUMOReal a)
 
void pfSetCenter (int onOff)
 
int pfSetFont (pffont *f)
 
void pfSetPosition (SUMOReal x, SUMOReal y)
 
void pfSetScale (SUMOReal s)
 
int pfSetScaleBox (char *c, SUMOReal w, SUMOReal h)
 
int pfSetScaleBoxW (wchar_t *c, SUMOReal w, SUMOReal h)
 
void pfSetScaleXY (SUMOReal sx, SUMOReal sy)
 
void pfSetSkew (SUMOReal s)
 
void pfSetWeight (int w)
 
static SUMOReal pfSkew (SUMOReal x, SUMOReal y)
 
void pfUnloadFont (pffont *font)
 
static void validate (pffont *font)
 

Variables

static nameValue glPrims []
 
static int pfCenter = 0
 
static pffontpfCurrentFont = &pfPSansBold16
 
static pffontpfDefaultFont = &pfPSansBold16
 
static SUMOReal pfScaleX = 20.0
 
static SUMOReal pfScaleY = 20.0
 
static SUMOReal pfTextCos = 1.0
 
static SUMOReal pfTextSin = 0.0
 
static SUMOReal pfTextSkew = 0.0
 
static int pfTextWeight = 1
 
static SUMOReal pfTextX = 0.0
 
static SUMOReal pfTextY = 0.0
 
vertex weightOffset []
 

Macro Definition Documentation

§ abs

§ DtoR

#define DtoR   (PI/180.0)

Definition at line 63 of file polyfonts.c.

Referenced by pfSetAngleD().

§ max

#define max (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 65 of file polyfonts.c.

Referenced by TplConvert::_2int(), TplConvert::_hex2int(), MSLCM_SL2015::_wantsChangeSublane(), SUMOVehicleParserHelper::beginVTypeParsing(), CHRouter< E, V, PF >::buildContractionHierarchy(), MSLeaderDistanceInfo::clear(), MSCriticalFollowerDistanceInfo::clear(), TraCIServerAPI_Vehicle::commandDistanceRequest(), DijkstraRouterTT< MSEdge, SUMOVehicle, prohibited_withPermissions< MSEdge, SUMOVehicle > >::compute(), DijkstraRouterEffort< MSEdge, SUMOVehicle, prohibited_withPermissions< MSEdge, SUMOVehicle > >::compute(), AStarRouter< MSEdge, SUMOVehicle, prohibited_withPermissions< MSEdge, SUMOVehicle > >::compute(), CHRouter< E, V, PF >::compute(), computeRoutes(), NIImporter_OpenDrive::computeShapes(), MSLCM_SL2015::computeSublaneShift(), TraCIServerAPI_Simulation::convertCartesianToRoadMap(), MSAbstractLaneChangeModel::decideDirection(), SPTree< CHRouter::CHInfo, CHRouter::CHConnection >::dijkstraTT(), PositionVector::distance2D(), MSVehicle::executeMove(), MSLaneChanger::findCandidate(), NBEdge::firstIntersection(), MSActuatedTrafficLightLogic::gapControl(), GawronCalculator< R, E, V >::gawronF(), GawronCalculator< R, E, V >::gawronG(), LogitCalculator< R, E, V >::getBetaForCLogit(), MSLane::getCriticalLeader(), MSRoute::getDistanceBetween(), MSVehicle::getDistanceToPosition(), MSE2Collector::getEstimatedCurrentVehicleNumber(), MSE2Collector::getEstimateQueueLength(), MSLane::getFirstVehicleInformation(), MSLane::getFollowerOnConsecutive(), MSEdge::getFreeLane(), RODFDetectorFlows::getMaxDetectorFlow(), GUITexturesHelper::getMaxTextureSize(), NBContHelper::same_connection_edge_sorter::getMinMaxRelAngles(), MSLane::getMoveReminders(), GUISUMOAbstractView::getObjectAtPosition(), MSLCM_SL2015::getSlowest(), MSCFModel::getSpeedAfterMaxDecel(), getStringBox(), getStringBoxW(), LogitCalculator< R, E, V >::getThetaForCLogit(), PublicTransportEdge< E, L, N, V >::getTravelTime(), PositionVector::indexOfClosest(), MSLCM_LC2013::informLeader(), PositionVector::insertAtClosest(), MESegment::jamThresholdForSpeed(), NBNodeCont::joinJunctions(), NBContHelper::maxSpeed(), VectorHelper< T >::maxValue(), VectorHelper< T >::minValue(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), PositionVector::nearest_offset_to_point2D(), GUIParameterTracker::onCmdSave(), SUMOVehicleParserHelper::parseFlowAttributes(), pfSetSkew(), pfSetWeight(), MSVehicle::planMoveInternal(), MSLCM_SL2015::prepareStep(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Vehicle::processSet(), SPTree< CHRouter::CHInfo, CHRouter::CHConnection >::rebuildFrom(), NIImporter_OpenStreetMap::reconstructLayerElevation(), PositionVector::removeClosest(), MSDevice_Routing::reroute(), DijkstraRouterEffort< E, V, PF >::EdgeInfo::reset(), DijkstraRouterTT< E, V, PF >::EdgeInfo::reset(), AStarRouter< E, V, PF >::EdgeInfo::reset(), CHRouter< E, V, PF >::EdgeInfo::reset(), CHRouter< E, V, PF >::CHInfo::reset(), MSFrame::setMSGlobals(), MFXAddEditTypedTable::setNumberCellParams(), CHRouter< E, V, PF >::Unidirectional::step(), PositionVector::transformToVectorCoordinates(), MSActuatedTrafficLightLogic::trySwitch(), CHRouter< E, V, PF >::tryUpdateFront(), MSSwarmTrafficLightLogic::updateSensitivities(), SUMOVTypeParameter::write(), and GeoConvHelper::x2cartesian_const().

§ min

§ numWeights

#define numWeights   (sizeof(weightOffset) / sizeof(vertex))

Definition at line 129 of file polyfonts.c.

Referenced by pfSetWeight().

§ PI

§ RtoD

#define RtoD   (180.0/PI)

Definition at line 62 of file polyfonts.c.

§ sign

#define sign (   a)    (((a)<0) ? -1 : (a)>0 ? 1 : 0)

§ unfix

#define unfix (   value)    ((SUMOReal)(value)) / ((SUMOReal)pfFixScale)

Definition at line 136 of file polyfonts.c.

Referenced by drawWideChar().

Function Documentation

§ comp()

static int comp ( const void *  key,
const void *  target 
)
static

Definition at line 820 of file polyfonts.c.

References pfglyph::glyph.

Referenced by pfFindGlyph().

§ drawWideChar()

§ getCharAdvance()

static SUMOReal getCharAdvance ( wchar_t  c)
static

Definition at line 855 of file polyfonts.c.

References pfglyph::advance, and pfGetGlyph().

Referenced by getStringBox(), and getStringBoxW().

§ getCharBBox()

static int getCharBBox ( wchar_t  c,
SUMOReal minx,
SUMOReal miny,
SUMOReal maxx,
SUMOReal maxy 
)
static

§ getStringBox()

static int getStringBox ( char *  c,
SUMOReal minx,
SUMOReal miny,
SUMOReal maxx,
SUMOReal maxy 
)
static

Definition at line 558 of file polyfonts.c.

References getCharAdvance(), getCharBBox(), max, min, and SUMOReal.

Referenced by pfSetScaleBox().

§ getStringBoxW()

static int getStringBoxW ( wchar_t *  c,
SUMOReal minx,
SUMOReal miny,
SUMOReal maxx,
SUMOReal maxy 
)
static

Definition at line 598 of file polyfonts.c.

References getCharAdvance(), getCharBBox(), max, min, and SUMOReal.

Referenced by pfSetScaleBoxW().

§ lookupGlOp()

static int lookupGlOp ( char *  op)
static

Definition at line 188 of file polyfonts.c.

References glPrims.

Referenced by pfUnloadFont().

§ pfdkGetStringWidth()

§ pfDrawChar()

int pfDrawChar ( wchar_t  c)

Definition at line 1058 of file polyfonts.c.

References drawWideChar().

§ pfDrawString()

§ pfDrawStringW()

int pfDrawStringW ( wchar_t *  c)

Definition at line 1093 of file polyfonts.c.

References drawWideChar(), and SUMOReal.

§ pfFindGlyph()

static pfglyph* pfFindGlyph ( pfglyph glyphs,
int  numglyphs,
pfglyph find 
)
static

Definition at line 830 of file polyfonts.c.

References comp().

Referenced by pfGetGlyph().

§ pfGetChar()

wchar_t pfGetChar ( int  g)

Definition at line 801 of file polyfonts.c.

References pfglyph::glyph, pffont::glyphs, and pffont::numglyphs.

§ pfGetCharAdvance()

SUMOReal pfGetCharAdvance ( wchar_t  c)

Definition at line 869 of file polyfonts.c.

References pfglyph::advance, pfGetGlyph(), and pfScaleX.

Referenced by pfdkGetStringWidth().

§ pfGetCharAscent()

SUMOReal pfGetCharAscent ( wchar_t  c)

Definition at line 946 of file polyfonts.c.

References pfGetCharBBox(), and SUMOReal.

§ pfGetCharBBox()

int pfGetCharBBox ( wchar_t  c,
SUMOReal minx,
SUMOReal miny,
SUMOReal maxx,
SUMOReal maxy 
)

§ pfGetCharDescent()

SUMOReal pfGetCharDescent ( wchar_t  c)

Definition at line 960 of file polyfonts.c.

References pfGetCharBBox(), and SUMOReal.

§ pfGetCharHeight()

SUMOReal pfGetCharHeight ( wchar_t  c)

Definition at line 918 of file polyfonts.c.

References pfGetCharBBox(), and SUMOReal.

§ pfGetCharWidth()

SUMOReal pfGetCharWidth ( wchar_t  c)

Definition at line 932 of file polyfonts.c.

References pfGetCharBBox(), and SUMOReal.

§ pfGetCurrentFont()

pffont* pfGetCurrentFont ( )

Definition at line 692 of file polyfonts.c.

References pfCurrentFont.

§ pfGetFontAscent()

SUMOReal pfGetFontAscent ( )

Definition at line 761 of file polyfonts.c.

References pfGetFontBBox(), and SUMOReal.

§ pfGetFontBBox()

int pfGetFontBBox ( SUMOReal minx,
SUMOReal miny,
SUMOReal maxx,
SUMOReal maxy 
)

§ pfGetFontDescent()

SUMOReal pfGetFontDescent ( )

Definition at line 775 of file polyfonts.c.

References pfGetFontBBox(), and SUMOReal.

§ pfGetFontHeight()

SUMOReal pfGetFontHeight ( )

Definition at line 733 of file polyfonts.c.

References pfGetFontBBox(), and SUMOReal.

§ pfGetFontName()

char* pfGetFontName ( )

Definition at line 678 of file polyfonts.c.

References pffont::name.

§ pfGetFontNumGlyphs()

int pfGetFontNumGlyphs ( )

Definition at line 789 of file polyfonts.c.

References pffont::numglyphs.

§ pfGetFontWidth()

SUMOReal pfGetFontWidth ( )

Definition at line 747 of file polyfonts.c.

References pfGetFontBBox(), and SUMOReal.

§ pfGetGlyph()

static pfglyph * pfGetGlyph ( wchar_t  c)
static

§ pfGetPosition()

void pfGetPosition ( SUMOReal x,
SUMOReal y 
)

Definition at line 488 of file polyfonts.c.

References pfTextX, and pfTextY.

§ pfSetAngleD()

void pfSetAngleD ( SUMOReal  a)

Definition at line 518 of file polyfonts.c.

References DtoR, and pfSetAngleR().

§ pfSetAngleR()

void pfSetAngleR ( SUMOReal  a)

Definition at line 510 of file polyfonts.c.

References pfTextCos, and pfTextSin.

Referenced by pfSetAngleD().

§ pfSetCenter()

void pfSetCenter ( int  onOff)

Definition at line 525 of file polyfonts.c.

References pfCenter.

§ pfSetFont()

int pfSetFont ( pffont f)

Definition at line 152 of file polyfonts.c.

§ pfSetPosition()

§ pfSetScale()

§ pfSetScaleBox()

int pfSetScaleBox ( char *  c,
SUMOReal  w,
SUMOReal  h 
)

Definition at line 638 of file polyfonts.c.

References getStringBox(), pfSetScaleXY(), and SUMOReal.

§ pfSetScaleBoxW()

int pfSetScaleBoxW ( wchar_t *  c,
SUMOReal  w,
SUMOReal  h 
)

Definition at line 658 of file polyfonts.c.

References getStringBoxW(), pfSetScaleXY(), and SUMOReal.

§ pfSetScaleXY()

§ pfSetSkew()

void pfSetSkew ( SUMOReal  s)

Definition at line 496 of file polyfonts.c.

References max, min, and pfTextSkew.

§ pfSetWeight()

void pfSetWeight ( int  w)

Definition at line 503 of file polyfonts.c.

References max, min, numWeights, and pfTextWeight.

§ pfSkew()

static SUMOReal pfSkew ( SUMOReal  x,
SUMOReal  y 
)
static

Definition at line 145 of file polyfonts.c.

References pfTextSkew.

Referenced by drawWideChar(), pfGetCharBBox(), and pfGetFontBBox().

§ pfUnloadFont()

§ validate()

static void validate ( pffont font)
static

Variable Documentation

§ glPrims

nameValue glPrims[]
static
Initial value:
=
{
{"GL_POINTS", GL_POINTS},
{"GL_LINES", GL_LINES},
{"GL_LINE_LOOP", GL_LINE_LOOP},
{"GL_LINE_STRIP", GL_LINE_STRIP},
{"GL_TRIANGLES", GL_TRIANGLES},
{"GL_TRIANGLE_STRIP", GL_TRIANGLE_STRIP},
{"GL_TRIANGLE_FAN", GL_TRIANGLE_FAN},
{"GL_QUADS", GL_QUADS},
{"GL_QUAD_STRIP", GL_QUAD_STRIP},
{"GL_POLYGON", GL_POLYGON},
}

Definition at line 172 of file polyfonts.c.

Referenced by lookupGlOp().

§ pfCenter

int pfCenter = 0
static

Definition at line 134 of file polyfonts.c.

Referenced by drawWideChar(), and pfSetCenter().

§ pfCurrentFont

pffont* pfCurrentFont = &pfPSansBold16
static

Definition at line 83 of file polyfonts.c.

Referenced by pfGetCurrentFont().

§ pfDefaultFont

pffont* pfDefaultFont = &pfPSansBold16
static

Definition at line 84 of file polyfonts.c.

§ pfScaleX

SUMOReal pfScaleX = 20.0
static

§ pfScaleY

SUMOReal pfScaleY = 20.0
static

Definition at line 103 of file polyfonts.c.

Referenced by drawWideChar(), pfGetCharBBox(), pfGetFontBBox(), pfSetScale(), and pfSetScaleXY().

§ pfTextCos

SUMOReal pfTextCos = 1.0
static

Definition at line 132 of file polyfonts.c.

Referenced by drawWideChar(), and pfSetAngleR().

§ pfTextSin

SUMOReal pfTextSin = 0.0
static

Definition at line 131 of file polyfonts.c.

Referenced by drawWideChar(), and pfSetAngleR().

§ pfTextSkew

SUMOReal pfTextSkew = 0.0
static

Definition at line 108 of file polyfonts.c.

Referenced by pfGetCharBBox(), pfGetFontBBox(), pfSetSkew(), and pfSkew().

§ pfTextWeight

int pfTextWeight = 1
static

Definition at line 109 of file polyfonts.c.

Referenced by drawWideChar(), and pfSetWeight().

§ pfTextX

SUMOReal pfTextX = 0.0
static

Definition at line 105 of file polyfonts.c.

Referenced by drawWideChar(), pfGetPosition(), and pfSetPosition().

§ pfTextY

SUMOReal pfTextY = 0.0
static

Definition at line 106 of file polyfonts.c.

Referenced by drawWideChar(), pfGetPosition(), and pfSetPosition().

§ weightOffset

vertex weightOffset[]
Initial value:
= {
{0.0, 0.0},
{0.0, 1.0},
{1.0, 1.0},
{1.0, 0.0},
{0.0, 2.0},
{1.0, 2.0},
{2.0, 2.0},
{1.0, 2.0},
{0.0, 2.0},
}

Definition at line 116 of file polyfonts.c.