Duncan McIntyre / SimpleGUI

Dependents:   TouchScreenGUIDemo

Committer:
duncanFrance
Date:
Sun Apr 10 16:48:44 2016 +0000
Revision:
7:303850a4b30c
Parent:
Core/Font.h@3:cb004f59b715
Working implementation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
duncanFrance 7:303850a4b30c 1 #ifndef SIMPLEGUI_UNIGRAPHIC_FONT_H
duncanFrance 7:303850a4b30c 2 #define SIMPLEGUI_UNIGRAPHIC_FONT_H
duncanFrance 7:303850a4b30c 3
duncanFrance 7:303850a4b30c 4 #include "Font.h"
duncanFrance 7:303850a4b30c 5
duncanFrance 7:303850a4b30c 6 // Offset to the first glyph data
duncanFrance 7:303850a4b30c 7 #define UNIGRAPHIC_FONT_DATA_OFFSET 4
duncanFrance 7:303850a4b30c 8
duncanFrance 3:cb004f59b715 9 /**
duncanFrance 7:303850a4b30c 10 * A Font implementation based on the bitmap format used by the Unigraphic library
duncanFrance 3:cb004f59b715 11 **/
duncanFrance 7:303850a4b30c 12 class UGFont : public Font
duncanFrance 3:cb004f59b715 13 {
duncanFrance 3:cb004f59b715 14
duncanFrance 3:cb004f59b715 15 public:
duncanFrance 7:303850a4b30c 16
duncanFrance 7:303850a4b30c 17 UGFont(uint8_t* font, const uint8_t firstAsciiCode=32, const uint8_t lastAsciiCode=127, const bool proportional = true);
duncanFrance 7:303850a4b30c 18
duncanFrance 7:303850a4b30c 19 virtual uint8_t firstAscii();
duncanFrance 7:303850a4b30c 20 virtual uint8_t lastAscii();
duncanFrance 7:303850a4b30c 21 virtual uint8_t widthOf(char c);
duncanFrance 7:303850a4b30c 22 virtual uint8_t zoomedWidthOf(char c);
duncanFrance 7:303850a4b30c 23 virtual uint8_t height();
duncanFrance 7:303850a4b30c 24 virtual uint8_t zoomedHeight();
duncanFrance 7:303850a4b30c 25 virtual bool isProportional();
duncanFrance 3:cb004f59b715 26
duncanFrance 3:cb004f59b715 27 /**
duncanFrance 7:303850a4b30c 28 * Return the data part of the glyph - excluding the widht byte
duncanFrance 3:cb004f59b715 29 **/
duncanFrance 7:303850a4b30c 30 uint8_t* getGlyphData(char c);
duncanFrance 7:303850a4b30c 31 uint8_t bytesPerCol();
duncanFrance 7:303850a4b30c 32 uint8_t bytesPerGlyph();
duncanFrance 3:cb004f59b715 33
duncanFrance 3:cb004f59b715 34 private:
duncanFrance 3:cb004f59b715 35
duncanFrance 7:303850a4b30c 36 uint8_t* _font;
duncanFrance 7:303850a4b30c 37 uint8_t _width, _height, _bytesPerCol, _bytesPerGlyph;
duncanFrance 7:303850a4b30c 38 uint8_t _firstAscii, _lastAscii, _proportional;
duncanFrance 3:cb004f59b715 39
duncanFrance 3:cb004f59b715 40 };
duncanFrance 3:cb004f59b715 41 #endif