#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"
Go to the source code of this file.
Data Structures | |
| struct | nameValue |
| struct | vertex |
Defines | |
| #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 pfglyph * | pfFindGlyph (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) |
| pffont * | pfGetCurrentFont () |
| SUMOReal | pfGetFontAscent () |
| int | pfGetFontBBox (SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy) |
| SUMOReal | pfGetFontDescent () |
| SUMOReal | pfGetFontHeight () |
| char * | pfGetFontName () |
| int | pfGetFontNumGlyphs () |
| SUMOReal | pfGetFontWidth () |
| static pfglyph * | pfGetGlyph (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 pffont * | pfCurrentFont = &pfPSansBold16 |
| static pffont * | pfDefaultFont = &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 [] |
| #define abs | ( | a | ) | (((a)<0) ? -(a) : (a)) |
Definition at line 63 of file polyfonts.c.
Referenced by NIImporter_OpenDrive::calcPointOnCurve(), NIImporter_OpenDrive::calculateCurveCenter(), MSLCM_DK2004::currentDistAllows(), MSLCM_DK2004::currentDistDisallows(), NBNode::getMMLDirection(), GUIParameterTracker::GUIParameterTrackerPanel::patchHeightVal(), and MSVehicle::rebuildContinuationsFor().
| #define DtoR (PI/180.0) |
| #define max | ( | a, | |||
| b | ) | (((a) > (b)) ? (a) : (b)) |
Definition at line 61 of file polyfonts.c.
Referenced by DijkstraRouterTTBase< E, V, PF >::compute(), DijkstraRouterEffortBase< E, V, PF >::compute(), MSLaneChanger::findCandidate(), RORouteDef_Alternatives::gawronF(), RORouteDef_Alternatives::gawronG(), MSRoute::getDistanceBetween(), MSVehicle::getDistanceToPosition(), RODFDetectorFlows::getMaxDetectorFlow(), NBContHelper::same_connection_edge_sorter::getMinMaxRelAngles(), getStringBox(), getStringBoxW(), NBEdge::isNearEnough2BeJoined2(), main(), NBContHelper::maxSpeed(), GUIParameterTracker::onCmdSave(), pfSetSkew(), pfSetWeight(), and TraCIDijkstraRouter< E >::EdgeInfoCont::reset().
| #define min | ( | a, | |||
| b | ) | (((a) < (b)) ? (a) : (b)) |
Definition at line 62 of file polyfonts.c.
Referenced by NBContHelper::same_connection_edge_sorter::getMinMaxRelAngles(), getStringBox(), getStringBoxW(), main(), pfSetSkew(), and pfSetWeight().
| #define numWeights (sizeof(weightOffset) / sizeof(vertex)) |
| #define PI (3.1415926535897932384626433) |
Definition at line 57 of file polyfonts.c.
Referenced by NBHelpers::angle(), GeomHelper::Angle2D(), Position2DVector::around(), Line2D::atan2DegreeAngle(), Line2D::atan2PositiveAngle(), NIImporter_OpenDrive::calculateCurveCenter(), NBNodeShapeComputer::computeContinuationNodeShape(), NBNode::computeInternalLaneShape(), NBNodeShapeComputer::computeNodeShapeByCrosses(), computeSameEnd(), HelpersHBEFA::computeUsing(), NGRandomNetBuilder::createNewNode(), NGNet::createSpiderWeb(), GLHelper::drawBoxLines(), GLHelper::drawFilledCircle(), GUIVehicle::drawGL(), GLHelper::drawOutlineCircle(), fillOptions(), GUIBusStop::GUIBusStop(), GUILaneWrapper::GUILaneWrapper(), GUI_E2_ZS_Collector::MyWrapper::myConstruct(), ROWdrawAction_drawArrows(), ROWdrawAction_drawLinkNo(), ROWdrawAction_drawLinkRules(), ROWdrawAction_drawTLSLinkNo(), GUIVehicle::Colorer::setFunctionalColor(), TEST(), NBNode::writeXMLInternalLinks(), and GeoConvHelper::x2cartesian().
| #define RtoD (180.0/PI) |
Definition at line 58 of file polyfonts.c.
| #define sign | ( | a | ) | (((a)<0) ? -1 : (a)>0 ? 1 : 0) |
| #define unfix | ( | value | ) | ((SUMOReal)(value)) / ((SUMOReal)pfFixScale) |
| static int comp | ( | const void * | key, | |
| const void * | target | |||
| ) | [static] |
Definition at line 816 of file polyfonts.c.
References pfglyph::glyph.
Referenced by pfFindGlyph().
00817 { 00818 pfglyph *k = (pfglyph *)key; 00819 pfglyph *t = (pfglyph *)target; 00820 00821 return (k->glyph) - (t->glyph); 00822 }
| static int drawWideChar | ( | wchar_t | c | ) | [static] |
Definition at line 970 of file polyfonts.c.
References pfglyph::advance, pfglyph::maxx, pfglyph::maxy, pfglyph::minx, pfglyph::miny, pfglyph::numsegments, pfCenter, pfGetGlyph(), pfScaleX, pfScaleY, pfSkew(), pfTextCos, pfTextSin, pfTextWeight, pfTextX, pfTextY, pfglyph::segments, SUMOReal, unfix, vertex::x, and vertex::y.
Referenced by pfDrawChar(), pfDrawString(), and pfDrawStringW().
00971 { 00972 int i; 00973 int j; 00974 int k; 00975 pfglyph *g = pfGetGlyph(c); 00976 pfint16 *d = NULL; 00977 int segs = 0; 00978 int prim = 0; 00979 int points = 0; 00980 SUMOReal gx, gy; 00981 SUMOReal ox, oy; 00982 SUMOReal tmp = -100.0; 00983 00984 if (NULL == g) 00985 { 00986 return -1; 00987 } 00988 00989 ox = 0.0; 00990 oy = 0.0; 00991 if (pfCenter) 00992 { 00993 oy = pfScaleY * ((g->maxy + g->miny) / 2.0); 00994 ox = pfScaleX * ((g->maxx + g->minx) / 2.0); 00995 } 00996 00997 for (k = 0; k < pfTextWeight; k++) 00998 { 00999 segs = g->numsegments; 01000 d = g->segments; 01001 01002 for (i = 0; i < segs; i++) 01003 { 01004 prim = *d++; 01005 points = *d++; 01006 01007 glBegin(prim);//sglBegin(s, prim); 01008 for (j = 0; j < points; j++) 01009 { 01010 gx = unfix(*d++); 01011 gy = unfix(*d++); 01012 01013 gx = (gx * pfScaleX); 01014 gy = (gy * pfScaleY); 01015 01016 gx += weightOffset[k].x; 01017 gy += weightOffset[k].y; 01018 01019 gx = pfSkew(gx, gy); 01020 01021 tmp = gx; 01022 gx = (pfTextX - ox) + ((pfTextCos * tmp) - (pfTextSin * gy)); 01023 gy = (pfTextY + oy) - ((pfTextSin * tmp) + (pfTextCos * gy)); 01024 01025 glVertex2f(gx, gy);//sglVertex2f(gx, gy); 01026 } 01027 glEnd();//sglEnd(); 01028 } 01029 } 01030 01031 /* 01032 sglColor3f(0.0, 1.0, 0.0); 01033 sglBegin(s, GL_LINES); 01034 sglVertex2f(pfTextX - pfScaleX, pfTextY); 01035 sglVertex2f(pfTextX + pfScaleX, pfTextY); 01036 sglEnd(); 01037 01038 sglColor3f(0.0, 1.0, 0.0); 01039 sglBegin(s, GL_LINES); 01040 sglVertex2f(pfTextX, pfTextY - pfScaleY); 01041 sglVertex2f(pfTextX, pfTextY + pfScaleX); 01042 sglEnd(); 01043 */ 01044 01045 tmp = (g->advance * pfScaleX); 01046 pfTextX += tmp * pfTextCos; 01047 pfTextY -= tmp * pfTextSin; 01048 01049 return 0; 01050 }
| static SUMOReal getCharAdvance | ( | wchar_t | c | ) | [static] |
Definition at line 851 of file polyfonts.c.
References pfglyph::advance, and pfGetGlyph().
Referenced by getStringBox(), and getStringBoxW().
00852 { 00853 pfglyph *g = pfGetGlyph(c); 00854 00855 if (NULL == g) 00856 { 00857 return 0.0; 00858 } 00859 00860 return g->advance; 00861 }
| static int getCharBBox | ( | wchar_t | c, | |
| SUMOReal * | minx, | |||
| SUMOReal * | miny, | |||
| SUMOReal * | maxx, | |||
| SUMOReal * | maxy | |||
| ) | [static] |
Definition at line 528 of file polyfonts.c.
References pfglyph::maxx, pfglyph::maxy, pfglyph::minx, pfglyph::miny, and pfGetGlyph().
Referenced by getStringBox(), getStringBoxW(), and pfGetCharBBox().
00529 { 00530 if (NULL != pfCurrentFont) 00531 { 00532 pfglyph *g = pfGetGlyph(c); 00533 if (NULL != g) 00534 { 00535 *minx = g->minx; 00536 *miny = g->miny; 00537 00538 *maxx = g->maxx; 00539 *maxy = g->maxy; 00540 } 00541 return 0; 00542 } 00543 00544 *minx = 0; 00545 *miny = 0; 00546 *maxx = 0; 00547 *maxy = 0; 00548 00549 return -1; 00550 }
| static int getStringBox | ( | char * | c, | |
| SUMOReal * | minx, | |||
| SUMOReal * | miny, | |||
| SUMOReal * | maxx, | |||
| SUMOReal * | maxy | |||
| ) | [static] |
Definition at line 554 of file polyfonts.c.
References getCharAdvance(), getCharBBox(), max, min, and SUMOReal.
Referenced by pfSetScaleBox().
00555 { 00556 SUMOReal x1, y1, x2, y2; 00557 00558 if (NULL == c) 00559 { 00560 return -1; 00561 } 00562 00563 if (-1 == getCharBBox(*c, &x1, &y1, &x2, &y2)) 00564 { 00565 return -1; 00566 } 00567 00568 *minx = x1; 00569 *miny = y1; 00570 *maxx = getCharAdvance(*c); 00571 *maxy = y2; 00572 00573 c++; 00574 00575 while (0 != *c) 00576 { 00577 if (-1 == getCharBBox(*c, &x1, &y1, &x2, &y2)) 00578 { 00579 return -1; 00580 } 00581 00582 *miny = min(*miny, y1); 00583 *maxx += getCharAdvance(*c); 00584 *maxy = max(*maxy, y2); 00585 00586 c++; 00587 } 00588 00589 return 0; 00590 }
| static int getStringBoxW | ( | wchar_t * | c, | |
| SUMOReal * | minx, | |||
| SUMOReal * | miny, | |||
| SUMOReal * | maxx, | |||
| SUMOReal * | maxy | |||
| ) | [static] |
Definition at line 594 of file polyfonts.c.
References getCharAdvance(), getCharBBox(), max, min, and SUMOReal.
Referenced by pfSetScaleBoxW().
00595 { 00596 SUMOReal x1, y1, x2, y2; 00597 00598 if (NULL == c) 00599 { 00600 return -1; 00601 } 00602 00603 if (-1 == getCharBBox(*c, &x1, &y1, &x2, &y2)) 00604 { 00605 return -1; 00606 } 00607 00608 *minx = x1; 00609 *miny = y1; 00610 *maxx = getCharAdvance(*c); 00611 *maxy = y2; 00612 00613 c++; 00614 00615 while (0 != *c) 00616 { 00617 if (-1 == getCharBBox(*c, &x1, &y1, &x2, &y2)) 00618 { 00619 return -1; 00620 } 00621 00622 *miny = min(*miny, y1); 00623 *maxx += getCharAdvance(*c); 00624 *maxy = max(*maxy, y2); 00625 00626 c++; 00627 } 00628 00629 return 0; 00630 }
| static int lookupGlOp | ( | char * | op | ) | [static] |
Definition at line 184 of file polyfonts.c.
00185 { 00186 int i; 00187 00188 for (i = 0; i < (sizeof(glPrims) / sizeof(nameValue)); i++) 00189 { 00190 if (0 == strcmp(glPrims[i].name, op)) 00191 { 00192 return i; 00193 } 00194 } 00195 00196 return -1; 00197 }
| SUMOReal pfdkGetStringWidth | ( | const char * | c | ) |
Definition at line 1109 of file polyfonts.c.
References pfGetCharAdvance(), and SUMOReal.
Referenced by drawAction_drawVehicleName(), GUITriggeredRerouter::drawGL(), GUILaneSpeedTrigger::drawGL(), GUIJunctionWrapper::drawGL(), GUIEdge::drawGL(), GUIBusStop::drawGL(), GUIGlObject_AbstractAdd::drawGLName(), GUIParameterTracker::GUIParameterTrackerPanel::drawValue(), GUITLLogicPhasesTrackerWindow::drawValues(), ROWdrawAction_drawLinkNo(), and ROWdrawAction_drawTLSLinkNo().
01110 { 01111 SUMOReal w = 0; 01112 while (0 != *c) { 01113 w += pfGetCharAdvance(/*s,*/ *c); 01114 c++; 01115 } 01116 return w; 01117 }
| int pfDrawChar | ( | wchar_t | c | ) |
Definition at line 1054 of file polyfonts.c.
References drawWideChar().
01055 { 01056 int value = 0; 01057 /* 01058 if (NULL == s) 01059 { 01060 return -1; 01061 } 01062 */ 01063 value = drawWideChar(/*s,*/ c); 01064 01065 return value; 01066 }
| int pfDrawString | ( | const char * | c | ) |
Definition at line 1070 of file polyfonts.c.
References drawWideChar().
Referenced by GUISUMOAbstractView::displayLegend(), drawAction_drawVehicleName(), GUITriggeredRerouter::drawGL(), GUIPointOfInterest::drawGL(), GUILaneSpeedTrigger::drawGL(), GUIJunctionWrapper::drawGL(), GUIEdge::drawGL(), GUIBusStop::drawGL(), GUIGlObject_AbstractAdd::drawGLName(), GUIParameterTracker::GUIParameterTrackerPanel::drawValue(), GUITLLogicPhasesTrackerWindow::drawValues(), ROWdrawAction_drawLinkNo(), and ROWdrawAction_drawTLSLinkNo().
01071 { 01072 /* 01073 if ((NULL == s) || (NULL == c)) 01074 { 01075 return -1; 01076 } 01077 */ 01078 while (0 != *c) 01079 { 01080 drawWideChar(/*s,*/ *c); 01081 c++; 01082 } 01083 01084 return 0; 01085 }
| int pfDrawStringW | ( | wchar_t * | c | ) |
Definition at line 1089 of file polyfonts.c.
References drawWideChar().
01090 { 01091 /* 01092 if ((NULL == s) || (NULL == c)) 01093 { 01094 return -1; 01095 } 01096 */ 01097 while (0 != *c) 01098 { 01099 drawWideChar(/*s,*/ *c); 01100 c++; 01101 } 01102 01103 return 0; 01104 }
Definition at line 826 of file polyfonts.c.
References comp().
Referenced by pfGetGlyph().
00827 { 00828 return (pfglyph *) bsearch((void *)find, (void *)glyphs, numglyphs, sizeof(pfglyph), comp); 00829 }
| wchar_t pfGetChar | ( | int | g | ) |
Definition at line 797 of file polyfonts.c.
References pfglyph::glyph, pffont::glyphs, and pffont::numglyphs.
00798 { 00799 wchar_t c = 0; 00800 int ng = -1; 00801 00802 if (NULL != pfCurrentFont) 00803 { 00804 ng = pfCurrentFont->numglyphs; 00805 if ((g >= 0) && (g < ng)) 00806 { 00807 c = pfCurrentFont->glyphs[g].glyph; 00808 } 00809 } 00810 00811 return c; 00812 }
| SUMOReal pfGetCharAdvance | ( | wchar_t | c | ) |
Definition at line 865 of file polyfonts.c.
References pfglyph::advance, pfGetGlyph(), and pfScaleX.
Referenced by pfdkGetStringWidth().
00866 { 00867 pfglyph *g = pfGetGlyph(c); 00868 00869 if (NULL == g) 00870 { 00871 return 0.0; 00872 } 00873 00874 return (g->advance * pfScaleX); 00875 }
| SUMOReal pfGetCharAscent | ( | wchar_t | c | ) |
Definition at line 942 of file polyfonts.c.
References pfGetCharBBox(), and SUMOReal.
00943 { 00944 SUMOReal minx, miny, maxx, maxy; 00945 00946 if (-1 != pfGetCharBBox(c, &minx, &miny, &maxx, &maxy)) 00947 { 00948 return maxy; 00949 } 00950 00951 return 0.0; 00952 }
| int pfGetCharBBox | ( | wchar_t | c, | |
| SUMOReal * | minx, | |||
| SUMOReal * | miny, | |||
| SUMOReal * | maxx, | |||
| SUMOReal * | maxy | |||
| ) |
Definition at line 879 of file polyfonts.c.
References getCharBBox(), pfScaleX, pfScaleY, pfSkew(), and pfTextSkew.
Referenced by pfGetCharAscent(), pfGetCharDescent(), pfGetCharHeight(), and pfGetCharWidth().
00880 { 00881 if (0 == getCharBBox(c, minx, miny, maxx, maxy)) 00882 { 00883 *minx = pfScaleX * (*minx); 00884 *miny = pfScaleY * (*miny); 00885 00886 *maxx = pfScaleX * (*maxx); 00887 *maxy = pfScaleY * (*maxy); 00888 00889 if (pfTextSkew > 0) 00890 { 00891 *minx = pfSkew(*minx, *miny); 00892 *maxx = pfSkew(*maxx, *maxy); 00893 } 00894 else 00895 { 00896 *minx = pfSkew(*minx, *maxy); 00897 *maxx = pfSkew(*maxx, *miny); 00898 } 00899 00900 00901 return 0; 00902 } 00903 00904 *minx = 0; 00905 *miny = 0; 00906 *maxx = 0; 00907 *maxy = 0; 00908 00909 return -1; 00910 }
| SUMOReal pfGetCharDescent | ( | wchar_t | c | ) |
Definition at line 956 of file polyfonts.c.
References pfGetCharBBox(), and SUMOReal.
00957 { 00958 SUMOReal minx, miny, maxx, maxy; 00959 00960 if (-1 != pfGetCharBBox(c, &minx, &miny, &maxx, &maxy)) 00961 { 00962 return miny; 00963 } 00964 00965 return 0.0; 00966 }
| SUMOReal pfGetCharHeight | ( | wchar_t | c | ) |
Definition at line 914 of file polyfonts.c.
References pfGetCharBBox(), and SUMOReal.
00915 { 00916 SUMOReal minx, miny, maxx, maxy; 00917 00918 if (-1 != pfGetCharBBox(c, &minx, &miny, &maxx, &maxy)) 00919 { 00920 return maxy - miny; 00921 } 00922 00923 return 0.0; 00924 }
| SUMOReal pfGetCharWidth | ( | wchar_t | c | ) |
Definition at line 928 of file polyfonts.c.
References pfGetCharBBox(), and SUMOReal.
00929 { 00930 SUMOReal minx, miny, maxx, maxy; 00931 00932 if (-1 != pfGetCharBBox(c, &minx, &miny, &maxx, &maxy)) 00933 { 00934 return maxx - minx; 00935 } 00936 00937 return 0.0; 00938 }
| pffont* pfGetCurrentFont | ( | ) |
| SUMOReal pfGetFontAscent | ( | ) |
Definition at line 757 of file polyfonts.c.
References pfGetFontBBox(), and SUMOReal.
00758 { 00759 SUMOReal minx, miny, maxx, maxy; 00760 00761 if (-1 != pfGetFontBBox(&minx, &miny, &maxx, &maxy)) 00762 { 00763 return maxy; 00764 } 00765 00766 return 0.0; 00767 }
| int pfGetFontBBox | ( | SUMOReal * | minx, | |
| SUMOReal * | miny, | |||
| SUMOReal * | maxx, | |||
| SUMOReal * | maxy | |||
| ) |
Definition at line 695 of file polyfonts.c.
References pffont::maxx, pffont::maxy, pffont::minx, pffont::miny, pfScaleX, pfScaleY, pfSkew(), and pfTextSkew.
Referenced by pfGetFontAscent(), pfGetFontDescent(), pfGetFontHeight(), and pfGetFontWidth().
00696 { 00697 if (NULL != pfCurrentFont) 00698 { 00699 *minx = pfScaleX * pfCurrentFont->minx; 00700 *miny = pfScaleY * pfCurrentFont->miny; 00701 00702 *maxx = pfScaleX * pfCurrentFont->maxx; 00703 *maxy = pfScaleY * pfCurrentFont->maxy; 00704 00705 if (pfTextSkew > 0) 00706 { 00707 *minx = pfSkew(*minx, *miny); 00708 *maxx = pfSkew(*maxx, *maxy); 00709 } 00710 else 00711 { 00712 *minx = pfSkew(*minx, *maxy); 00713 *maxx = pfSkew(*maxx, *miny); 00714 } 00715 00716 return 0; 00717 } 00718 00719 *minx = 0; 00720 *miny = 0; 00721 *maxx = 0; 00722 *maxy = 0; 00723 00724 return -1; 00725 }
| SUMOReal pfGetFontDescent | ( | ) |
Definition at line 771 of file polyfonts.c.
References pfGetFontBBox(), and SUMOReal.
00772 { 00773 SUMOReal minx, miny, maxx, maxy; 00774 00775 if (-1 != pfGetFontBBox(&minx, &miny, &maxx, &maxy)) 00776 { 00777 return miny; 00778 } 00779 00780 return 0.0; 00781 }
| SUMOReal pfGetFontHeight | ( | ) |
Definition at line 729 of file polyfonts.c.
References pfGetFontBBox(), and SUMOReal.
00730 { 00731 SUMOReal minx, miny, maxx, maxy; 00732 00733 if (-1 != pfGetFontBBox(&minx, &miny, &maxx, &maxy)) 00734 { 00735 return maxy - miny; 00736 } 00737 00738 return 0.0; 00739 }
| char* pfGetFontName | ( | ) |
Definition at line 674 of file polyfonts.c.
References pffont::name.
00675 { 00676 char *name = NULL; 00677 00678 if (NULL != pfCurrentFont) 00679 { 00680 name = pfCurrentFont->name; 00681 } 00682 00683 return name; 00684 }
| int pfGetFontNumGlyphs | ( | ) |
Definition at line 785 of file polyfonts.c.
References pffont::numglyphs.
00786 { 00787 if (NULL != pfCurrentFont) 00788 { 00789 return pfCurrentFont->numglyphs; 00790 } 00791 00792 return 0; 00793 }
| SUMOReal pfGetFontWidth | ( | ) |
Definition at line 743 of file polyfonts.c.
References pfGetFontBBox(), and SUMOReal.
00744 { 00745 SUMOReal minx, miny, maxx, maxy; 00746 00747 if (-1 != pfGetFontBBox(&minx, &miny, &maxx, &maxy)) 00748 { 00749 return maxx - minx; 00750 } 00751 00752 return 0.0; 00753 }
| static pfglyph * pfGetGlyph | ( | wchar_t | c | ) | [static] |
Definition at line 833 of file polyfonts.c.
References pfglyph::glyph, pffont::glyphs, pffont::numglyphs, and pfFindGlyph().
Referenced by drawWideChar(), getCharAdvance(), getCharBBox(), and pfGetCharAdvance().
00834 { 00835 pfglyph *g = NULL; 00836 pfglyph key; 00837 00838 if (NULL == pfCurrentFont) 00839 { 00840 return NULL; 00841 } 00842 00843 key.glyph = c; 00844 g = pfFindGlyph(pfCurrentFont->glyphs, pfCurrentFont->numglyphs, &key); 00845 00846 return g; 00847 }
| void pfGetPosition | ( | SUMOReal * | x, | |
| SUMOReal * | y | |||
| ) |
| void pfSetAngleD | ( | SUMOReal | a | ) |
Definition at line 514 of file polyfonts.c.
References DtoR, and pfSetAngleR().
00515 { 00516 pfSetAngleR(a * DtoR); 00517 }
| void pfSetAngleR | ( | SUMOReal | a | ) |
Definition at line 506 of file polyfonts.c.
References pfTextCos, and pfTextSin.
Referenced by pfSetAngleD().
| void pfSetCenter | ( | int | onOff | ) |
Definition at line 521 of file polyfonts.c.
References pfCenter.
00522 { 00523 pfCenter = onOff; 00524 }
| int pfSetFont | ( | pffont * | f | ) |
Definition at line 148 of file polyfonts.c.
00149 { 00150 if (NULL != f) 00151 { 00152 pfCurrentFont = f; 00153 00154 return 0; 00155 } 00156 00157 return -1; 00158 }
| void pfSetPosition | ( | SUMOReal | x, | |
| SUMOReal | y | |||
| ) |
Definition at line 476 of file polyfonts.c.
References pfTextX, and pfTextY.
Referenced by GUISUMOAbstractView::displayLegend(), drawAction_drawVehicleName(), GUITriggeredRerouter::drawGL(), GUIPointOfInterest::drawGL(), GUILaneSpeedTrigger::drawGL(), GUIJunctionWrapper::drawGL(), GUIEdge::drawGL(), GUIBusStop::drawGL(), GUIGlObject_AbstractAdd::drawGLName(), GUIParameterTracker::GUIParameterTrackerPanel::drawValue(), GUITLLogicPhasesTrackerWindow::drawValues(), ROWdrawAction_drawLinkNo(), and ROWdrawAction_drawTLSLinkNo().
| void pfSetScale | ( | SUMOReal | s | ) |
Definition at line 461 of file polyfonts.c.
References pfScaleX, and pfScaleY.
Referenced by drawAction_drawVehicleName(), GUITriggeredRerouter::drawGL(), GUIPointOfInterest::drawGL(), GUILaneSpeedTrigger::drawGL(), GUIJunctionWrapper::drawGL(), GUIEdge::drawGL(), GUIBusStop::drawGL(), GUIGlObject_AbstractAdd::drawGLName(), GUIParameterTracker::GUIParameterTrackerPanel::drawValues(), ROWdrawAction_drawLinkNo(), and ROWdrawAction_drawTLSLinkNo().
| int pfSetScaleBox | ( | char * | c, | |
| SUMOReal | w, | |||
| SUMOReal | h | |||
| ) |
Definition at line 634 of file polyfonts.c.
References getStringBox(), pfSetScaleXY(), and SUMOReal.
00635 { 00636 SUMOReal x1, y1, x2, y2; 00637 00638 if (NULL == c) 00639 { 00640 return -1; 00641 } 00642 00643 if (-1 == getStringBox(c, &x1, &y1, &x2, &y2)) 00644 { 00645 return -1; 00646 } 00647 00648 pfSetScaleXY((w / (x2 - x1)), (h / (y2 - y1))); 00649 return 0; 00650 }
| int pfSetScaleBoxW | ( | wchar_t * | c, | |
| SUMOReal | w, | |||
| SUMOReal | h | |||
| ) |
Definition at line 654 of file polyfonts.c.
References getStringBoxW(), pfSetScaleXY(), and SUMOReal.
00655 { 00656 SUMOReal x1, y1, x2, y2; 00657 00658 if (NULL == c) 00659 { 00660 return -1; 00661 } 00662 00663 if (-1 == getStringBoxW(c, &x1, &y1, &x2, &y2)) 00664 { 00665 return -1; 00666 } 00667 00668 pfSetScaleXY((w / (x2 - x1)), (h / (y2 - y1))); 00669 return 0; 00670 }
| void pfSetScaleXY | ( | SUMOReal | sx, | |
| SUMOReal | sy | |||
| ) |
Definition at line 468 of file polyfonts.c.
References pfScaleX, and pfScaleY.
Referenced by GUISUMOAbstractView::displayLegend(), GUITLLogicPhasesTrackerWindow::drawValues(), GUIParameterTracker::GUIParameterTrackerPanel::drawValues(), pfSetScaleBox(), and pfSetScaleBoxW().
| void pfSetSkew | ( | SUMOReal | s | ) |
Definition at line 492 of file polyfonts.c.
References max, min, and pfTextSkew.
00493 { 00494 pfTextSkew = min(1.0, max(-1.0, s)); 00495 }
| void pfSetWeight | ( | int | w | ) |
Definition at line 499 of file polyfonts.c.
References max, min, numWeights, and pfTextWeight.
00500 { 00501 pfTextWeight = min(numWeights, max(1, w)); 00502 }
| static SUMOReal pfSkew | ( | SUMOReal | x, | |
| SUMOReal | y | |||
| ) | [static] |
Definition at line 141 of file polyfonts.c.
References pfTextSkew.
Referenced by drawWideChar(), pfGetCharBBox(), and pfGetFontBBox().
00142 { 00143 return x + (pfTextSkew * y); 00144 }
| void pfUnloadFont | ( | pffont * | font | ) |
Definition at line 252 of file polyfonts.c.
References pffont::glyphs, pffont::loaded, pffont::name, and pffont::numglyphs.
00253 { 00254 int i; 00255 00256 pfglyph *glyphs = NULL; 00257 00258 if (NULL == font) 00259 { 00260 return; 00261 } 00262 00263 if (pfDefaultFont == font) 00264 { 00265 return; 00266 } 00267 00268 if (1 != font->loaded) 00269 { 00270 return; 00271 } 00272 00273 if (NULL == font->name) 00274 { 00275 return; 00276 } 00277 free(font->name); 00278 00279 if (NULL == font->glyphs) 00280 { 00281 return; 00282 } 00283 00284 glyphs = font->glyphs; 00285 for (i = 0; i < font->numglyphs; i++) 00286 { 00287 if (NULL != glyphs[i].segments) 00288 { 00289 free(glyphs[i].segments); 00290 } 00291 } 00292 00293 free(font->glyphs); 00294 00295 free(font); 00296 }
| static void validate | ( | pffont * | font | ) | [static] |
Definition at line 201 of file polyfonts.c.
References pffont::glyphs, pffont::maxx, pffont::maxy, pffont::minx, pffont::miny, pffont::name, and pffont::numglyphs.
00202 { 00203 int i; 00204 00205 pfglyph *glyph = NULL; 00206 00207 if (NULL == font) 00208 { 00209 printf("font is NULL\n"); 00210 } 00211 00212 if (NULL == font->name) 00213 { 00214 printf("fontname is NULL\n"); 00215 } 00216 00217 printf("fontinfo = %s %f, %f, %f, %f, %d %08x\n", 00218 font->name, 00219 font->minx, font->miny, 00220 font->maxx, font->maxy, 00221 font->numglyphs, 00222 (int)font->glyphs); 00223 00224 glyph = font->glyphs; 00225 if (NULL == glyph) 00226 { 00227 printf("glyph point is NULL\n"); 00228 } 00229 00230 printf("NumGlyphs = %d\n", font->numglyphs); 00231 00232 for (i = 0; i < font->numglyphs; i++) 00233 { 00234 if (NULL == glyph[i].segments) 00235 { 00236 printf("glyph[%d].segments = NULL\n", i); 00237 } 00238 00239 printf("glyph[%d] = %f, %f, %f, %f, %f, %hu, %hu %08x\n", 00240 i, 00241 glyph[i].minx, glyph[i].miny, 00242 glyph[i].maxx, glyph[i].maxy, 00243 glyph[i].advance, 00244 glyph[i].glyph, 00245 glyph[i].numsegments, 00246 (int)glyph[i].segments); 00247 } 00248 }
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 168 of file polyfonts.c.
int pfCenter = 0 [static] |
pffont* pfCurrentFont = &pfPSansBold16 [static] |
Definition at line 79 of file polyfonts.c.
pffont* pfDefaultFont = &pfPSansBold16 [static] |
Definition at line 80 of file polyfonts.c.
SUMOReal pfScaleX = 20.0 [static] |
Definition at line 98 of file polyfonts.c.
Referenced by drawWideChar(), pfGetCharAdvance(), pfGetCharBBox(), pfGetFontBBox(), pfSetScale(), and pfSetScaleXY().
SUMOReal pfScaleY = 20.0 [static] |
Definition at line 99 of file polyfonts.c.
Referenced by drawWideChar(), pfGetCharBBox(), pfGetFontBBox(), pfSetScale(), and pfSetScaleXY().
SUMOReal pfTextCos = 1.0 [static] |
SUMOReal pfTextSin = 0.0 [static] |
SUMOReal pfTextSkew = 0.0 [static] |
Definition at line 104 of file polyfonts.c.
Referenced by pfGetCharBBox(), pfGetFontBBox(), pfSetSkew(), and pfSkew().
int pfTextWeight = 1 [static] |
SUMOReal pfTextX = 0.0 [static] |
Definition at line 101 of file polyfonts.c.
Referenced by drawWideChar(), pfGetPosition(), and pfSetPosition().
SUMOReal pfTextY = 0.0 [static] |
Definition at line 102 of file polyfonts.c.
Referenced by drawWideChar(), pfGetPosition(), and pfSetPosition().
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 112 of file polyfonts.c.
1.5.6