| | 1 | [[TOC]] |
| | 2 | |
| | 3 | = CFont (825gen2) = |
| | 4 | |
| | 5 | CFont is a C++ class that is provided to manage fonts for the 825gen2 indicator. |
| | 6 | |
| | 7 | == Constructors == |
| | 8 | |
| | 9 | {{{ |
| | 10 | CBitmap(void); |
| | 11 | CBitmap(int num); |
| | 12 | }}} |
| | 13 | |
| | 14 | |
| | 15 | |
| | 16 | ==== Parameters ==== |
| | 17 | * num - |
| | 18 | |
| | 19 | ==== Examples ==== |
| | 20 | |
| | 21 | {{{ |
| | 22 | CFont fontBigLabel; |
| | 23 | int err = fontBigLabel.Load("/usr/share/fonts/ttf/LiberationSans-Bold.ttf", 42, 62); |
| | 24 | if(err) { |
| | 25 | DEBUG_MSG("Big Font load label error %d\n", err); |
| | 26 | } |
| | 27 | }}} |
| | 28 | |
| | 29 | |
| | 30 | == Member Functions == |
| | 31 | |
| | 32 | === CFreetypeFont& GetFont(int zoom) === |
| | 33 | Returns the contained CFreetypeFont for the specified zoom state. |
| | 34 | |
| | 35 | ==== Parameters ==== |
| | 36 | * zoom - |
| | 37 | |
| | 38 | ==== Return Value ==== |
| | 39 | |
| | 40 | |
| | 41 | ==== Remarks ==== |
| | 42 | |
| | 43 | |
| | 44 | ==== Example ==== |
| | 45 | |
| | 46 | {{{ |
| | 47 | |
| | 48 | }}} |
| | 49 | |
| | 50 | |
| | 51 | === Load === |
| | 52 | |
| | 53 | {{{ |
| | 54 | int Load(const char* filename, int pixHeight1, int pixHeight2); |
| | 55 | }}} |
| | 56 | |
| | 57 | ==== Parameters ==== |
| | 58 | * filename - path and filename of the font file |
| | 59 | * pixHeight1 - height of the font for normal state |
| | 60 | * pixHeight2 - height of the font for zoom state |
| | 61 | |
| | 62 | |
| | 63 | ==== Return Value ==== |
| | 64 | 0 if no error otherwise, freetype error value such as FT_Err_Unknown_File_Format. |
| | 65 | |
| | 66 | |
| | 67 | === SetPixelSize === |
| | 68 | |
| | 69 | {{{ |
| | 70 | int GetHeight(int zoom); |
| | 71 | }}} |
| | 72 | |
| | 73 | ==== Parameters ==== |
| | 74 | * zoom - |
| | 75 | |
| | 76 | ==== Return Value ==== |
| | 77 | Returns the pixel height for the specified zoom state |
| | 78 | |
| | 79 | |
| | 80 | === GetStrWidth === |
| | 81 | |
| | 82 | {{{ |
| | 83 | int GetStrWidth(const char* str, int len, int zoom); |
| | 84 | }}} |
| | 85 | |
| | 86 | ==== Parameters ==== |
| | 87 | * str - source string |
| | 88 | * len - number of characters of the string to evaluate |
| | 89 | * zoom - zoom state |
| | 90 | |
| | 91 | ==== Return Value ==== |
| | 92 | Returns the pixel height for the specified zoom state |
| | 93 | |
| | 94 | |
| | 95 | |
| | 96 | === DisplayText === |
| | 97 | Displays a string using the specified font. |
| | 98 | {{{ |
| | 99 | void DisplayText(const char* str, CDspArea *dspArea = NULL, int len = 0, int shortcutChar = 0); |
| | 100 | void DisplayText(std::string& str, CDspArea *dspArea = NULL, int len = 0, int shortcutChar = 0); |
| | 101 | void DisplayText(int x, int y, const char* str, CDspArea *dspArea = NULL, int len = 0, int shortcutChar = 0); |
| | 102 | void DisplayText(int x, int y, std::string& str, CDspArea *dspArea = NULL, int len = 0, int shortcutChar = 0); |
| | 103 | void DisplayText(CFormRect& rect, const char* str, int flag = 0, CDspArea* dspArea = NULL, int shortcutChar = 0); |
| | 104 | void DisplayText(CFormRect& rect, std::string& str, int flag = 0, CDspArea* dspArea = NULL, int shortcutChar = 0); |
| | 105 | }}} |
| | 106 | |
| | 107 | ==== Parameters ==== |
| | 108 | * str - source string |
| | 109 | * len - number of characters of the string to evaluate |
| | 110 | * zoom - zoom state |
| | 111 | |
| | 112 | ==== Return Value ==== |
| | 113 | Returns the pixel height for the specified zoom state |
| | 114 | |
| | 115 | |
| | 116 | |
| | 117 | |