Introduce decimal point font (#314)
* Introduce decimal point font * Add png of font * Add getting a decimal point str from int * Move font out of utils * Clang format * set Readme.md as main page in docs * Add font generator * kind of fix font * Fix image oddities * Added pip install pillow to build_ci_workflow * Added ensurepip * Update Docker/CI for font generation * Fix CI * Fix CI forreal * Another CI fix * Fix directory name for rom * Adjust directory * Dummy commit for test * Revert "Dummy commit for test" This reverts commit b607085c1322c824d2fdd800ab3c3700389ad3a6. * dos2unix and update .gitignore * Delete the generated font file * Delete the generated font file * remove dot from font * Update include/font.h Co-authored-by: MeirGavish <meir.gavish@gmail.com> --------- Co-authored-by: MeirGavish <meir.gavish@gmail.com>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @file font.h
|
||||
*
|
||||
* @brief Utility file to interact with custom font
|
||||
*/
|
||||
#ifndef FONT_H
|
||||
#define FONT_H
|
||||
|
||||
#include <tonc.h>
|
||||
|
||||
extern const TFont gbalatro_sys8Font;
|
||||
extern const unsigned int gbalatro_sys8Glyphs[192];
|
||||
|
||||
/** @name Decimal Point Fonts
|
||||
* @brief A set of macros to map the fonts decimal-point values (e.g. ".1")
|
||||
* to their replaced characters.
|
||||
*
|
||||
* "FP#" -> Font "Point" "number"
|
||||
*
|
||||
* This is used at compile time directly with the help of libtonc's XSTR() macro
|
||||
* **Note**: This should **ONLY** be used with the XSTR() macro, otherwise it
|
||||
* is undefined behavior.
|
||||
*
|
||||
* For example:
|
||||
* ```c
|
||||
* tte_printf("Testing " XSTR(FP0_CHAR) " Something!");
|
||||
* ```
|
||||
* prints "Testing .0 Something!"
|
||||
*
|
||||
* The map is the following:
|
||||
*
|
||||
* ```c
|
||||
* '&' == '.0'
|
||||
* '^' == '.1'
|
||||
* '{' == '.2'
|
||||
* '}' == '.3'
|
||||
* '|' == '.4'
|
||||
* '`' == '.5'
|
||||
* '<' == '.6'
|
||||
* '>' == '.7'
|
||||
* '_' == '.8'
|
||||
* ';' == '.9'
|
||||
* ```
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define FP0_CHAR & // .0
|
||||
#define FP1_CHAR ^ // .1
|
||||
#define FP2_CHAR { // .2
|
||||
#define FP3_CHAR } // .3
|
||||
#define FP4_CHAR | // .4
|
||||
#define FP5_CHAR ` // .5
|
||||
#define FP6_CHAR < // .6
|
||||
#define FP7_CHAR > // .7
|
||||
#define FP8_CHAR _ // .8
|
||||
#define FP9_CHAR ; // .9
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Get the decimal point string equivalent of 0-9 from integer param.
|
||||
*
|
||||
* @param val Value between 0-9 to get ".0" to ".9" equivalents. Note that
|
||||
* if a value outside of range is passed it will perform '% 10'
|
||||
* on that value and the last decimal digit will be used.
|
||||
*
|
||||
* @return A char* to the string values of '.0' to '.9'
|
||||
*/
|
||||
const char* get_font_point_str(int val);
|
||||
|
||||
#endif // FONT_H
|
||||
Reference in New Issue
Block a user