/* This is the core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.). It needs to be paired with a hardware-specific library for each display device we carry (to handle the lower-level functions). Adafruit invests time and resources providing this open source code, please support Adafruit & open-source hardware by purchasing products from Adafruit! Copyright (c) 2013 Adafruit Industries. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "Adafruit_GFX_AS.h" #ifdef LOAD_GLCD #include "glcdfont.c" #endif #ifdef LOAD_FONT2 #include "Font16.h" #endif #ifdef LOAD_FONT4 #include "Font32.h" #endif #ifdef LOAD_FONT6 #include "Font64.h" #endif #ifdef LOAD_FONT7 #include "Font7s.h" #endif #ifdef __AVR__ #include #else #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) #endif Adafruit_GFX_AS::Adafruit_GFX_AS(int16_t w, int16_t h): Adafruit_GFX(w, h) { } /*************************************************************************************** ** Function name: drawUnicode ** Descriptions: draw a unicode ***************************************************************************************/ int16_t Adafruit_GFX_AS::drawUnicode(uint16_t uniCode, int16_t x, int16_t y, int16_t size) { if (size) uniCode -= 32; uint16_t width = 0; uint16_t height = 0; uint32_t flash_address = 0; int16_t gap = 0; // if (size == 1) { // flash_address = pgm_read_dword(&chrtbl_f8[uniCode]); // width = pgm_read_byte(widtbl_f8+uniCode); // height = chr_hgt_f8; // gap = 1; // } #ifdef LOAD_FONT2 if (size == 2) { flash_address = pgm_read_dword(&chrtbl_f16[uniCode]); width = pgm_read_byte(widtbl_f16+uniCode); height = chr_hgt_f16; gap = 1; } #endif // if (size == 3) { // flash_address = pgm_read_dword(&chrtbl_f24[uniCode]); // width = pgm_read_byte(widtbl_f24+uniCode); // height = chr_hgt_f24; // gap = 0; // } #ifdef LOAD_FONT4 if (size == 4) { flash_address = pgm_read_dword(&chrtbl_f32[uniCode]); width = pgm_read_byte(widtbl_f32+uniCode); height = chr_hgt_f32; gap = -3; } #endif // if (size == 5) { // flash_address = pgm_read_dword(&chrtbl_f48[uniCode]); // width = pgm_read_byte(widtbl_f48+uniCode); // height = chr_hgt_f48; // gap = -3; // } #ifdef LOAD_FONT6 if (size == 6) { flash_address = pgm_read_dword(&chrtbl_f64[uniCode]); width = pgm_read_byte(widtbl_f64+uniCode); height = chr_hgt_f64; gap = -3; } #endif #ifdef LOAD_FONT7 if (size == 7) { flash_address = pgm_read_dword(&chrtbl_f7s[uniCode]); width = pgm_read_byte(widtbl_f7s+uniCode); height = chr_hgt_f7s; gap = 2; } #endif int16_t w = (width+7)/8; int16_t pX = 0; int16_t pY = y; int16_t color = 0; byte line = 0; //fillRect(x,pY,width+gap,height,textbgcolor); for(int16_t i=0; i0) { xPlus = drawChar('.',poX, poY, size); poX += xPlus; /* Move cursor right */ sumX += xPlus; } else { return sumX; } decy = floatNumber - temp; for(unsigned char i=0; i