#include <config.h>
#include "polyfonttypes.h"
Go to the source code of this file.
Functions | |
| SUMOReal | pfdkGetStringWidth (const char *c) |
| int | pfDrawChar (wchar_t c) |
| int | pfDrawString (const char *c) |
| int | pfDrawStringW (wchar_t *c) |
| wchar_t | pfGetChar (int glyph) |
| 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 () |
| 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) |
| void | pfUnloadFont (pffont *f) |
| 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 }
| wchar_t pfGetChar | ( | int | glyph | ) |
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 }
| 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 }
| void pfUnloadFont | ( | pffont * | f | ) |
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 }
1.5.6