From a18636ce87923f896365f0b3b0c8d2b515dfbd74 Mon Sep 17 00:00:00 2001 From: churl Date: Sun, 19 Jun 2022 13:23:54 +0200 Subject: [PATCH] reformat --- c_os/devices/fonts/Fonts.cc | 12 ++++++------ c_os/devices/fonts/Fonts.h | 37 ++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/c_os/devices/fonts/Fonts.cc b/c_os/devices/fonts/Fonts.cc index e97b847..0352ebc 100644 --- a/c_os/devices/fonts/Fonts.cc +++ b/c_os/devices/fonts/Fonts.cc @@ -11,9 +11,9 @@ #include "devices/fonts/Font_sun_12x22.h" #include "devices/fonts/Font_sun_8x16.h" -Font_8x16 std_font_8x16; -Font_8x8 std_font_8x8; -Font_acorn_8x8 acorn_font_8x8; -Font_pearl_8x8 pearl_font_8x8; -Font_sun_12x22 sun_font_12x22; -Font_sun_8x16 sun_font_8x16; +Font_8x16 std_font_8x16; +Font_8x8 std_font_8x8; +Font_acorn_8x8 acorn_font_8x8; +Font_pearl_8x8 pearl_font_8x8; +Font_sun_12x22 sun_font_12x22; +Font_sun_8x16 sun_font_8x16; diff --git a/c_os/devices/fonts/Fonts.h b/c_os/devices/fonts/Fonts.h index 3e8c7b9..21874aa 100644 --- a/c_os/devices/fonts/Fonts.h +++ b/c_os/devices/fonts/Fonts.h @@ -11,25 +11,22 @@ #ifndef __FONTS_H__ #define __FONTS_H__ - -class Font -{ +class Font { public: virtual unsigned char* getChar(int c) const = 0; virtual unsigned int get_char_width() const = 0; virtual unsigned int get_char_height() const = 0; }; - template -class FontInstance : public Font -{ +class FontInstance : public Font { const unsigned int char_width; const unsigned int char_height; const unsigned int char_mem_size; unsigned char* font_data; + public: - FontInstance() : char_width(width), char_height(height), char_mem_size((((char_width + (8 >> 1)) / 8) * char_height)), font_data(data) { } + FontInstance() : char_width(width), char_height(height), char_mem_size((((char_width + (8 >> 1)) / 8) * char_height)), font_data(data) {} inline unsigned char* getChar(int c) const { return &font_data[char_mem_size * c]; } @@ -41,7 +38,6 @@ public: } }; - extern unsigned char fontdata_8x16[]; extern unsigned char fontdata_8x8[]; extern unsigned char acorndata_8x8[]; @@ -49,19 +45,18 @@ extern unsigned char fontdata_pearl_8x8[]; extern unsigned char fontdata_sun_12x22[]; extern unsigned char fontdata_sun_8x16[]; +typedef FontInstance<8, 16, fontdata_8x16> Font_8x16; +typedef FontInstance<8, 8, fontdata_8x8> Font_8x8; +typedef FontInstance<8, 8, acorndata_8x8> Font_acorn_8x8; +typedef FontInstance<8, 8, fontdata_pearl_8x8> Font_pearl_8x8; +typedef FontInstance<12, 22, fontdata_sun_12x22> Font_sun_12x22; +typedef FontInstance<8, 16, fontdata_sun_8x16> Font_sun_8x16; -typedef FontInstance<8,16,fontdata_8x16> Font_8x16; -typedef FontInstance<8,8,fontdata_8x8> Font_8x8; -typedef FontInstance<8,8,acorndata_8x8> Font_acorn_8x8; -typedef FontInstance<8,8,fontdata_pearl_8x8> Font_pearl_8x8; -typedef FontInstance<12,22,fontdata_sun_12x22> Font_sun_12x22; -typedef FontInstance<8,16,fontdata_sun_8x16> Font_sun_8x16; - -extern Font_8x16 std_font_8x16; -extern Font_8x8 std_font_8x8; -extern Font_acorn_8x8 acorn_font_8x8; -extern Font_pearl_8x8 pearl_font_8x8; -extern Font_sun_12x22 sun_font_12x22; -extern Font_sun_8x16 sun_font_8x16; +extern Font_8x16 std_font_8x16; +extern Font_8x8 std_font_8x8; +extern Font_acorn_8x8 acorn_font_8x8; +extern Font_pearl_8x8 pearl_font_8x8; +extern Font_sun_12x22 sun_font_12x22; +extern Font_sun_8x16 sun_font_8x16; #endif