Compare commits

...

2 Commits

Author SHA1 Message Date
Lephenixnoir c9430ffdee
improve sub/superscript placement on fx-CG 50 2023-08-07 18:42:12 +02:00
Lephenixnoir e0b952503b
honor toolchain setting and default to sh-elf 2023-08-04 11:49:15 +02:00
5 changed files with 26 additions and 11 deletions

View File

@ -1,5 +1,5 @@
# Casio fx9860g library
TARGET = libTeX-fx.a
CFLAGS = -m3 -mb -D TEX_PLATFORM_FX9860G -D FX9860G -Os -ffreestanding
CC = sh3eb-elf-gcc
AR = sh3eb-elf-ar
CC = $(TOOLCHAIN)-gcc
AR = $(TOOLCHAIN)-ar

View File

@ -1,5 +1,5 @@
# Casio fxcg50 library
TARGET = libTeX-cg.a
CFLAGS = -m4-nofpu -mb -D TEX_PLATFORM_FXCG50 -D FXCG50 -Os -ffreestanding
CC = sh4eb-elf-gcc
AR = sh4eb-elf-ar
CC = $(TOOLCHAIN)-gcc
AR = $(TOOLCHAIN)-ar

4
configure vendored
View File

@ -60,8 +60,8 @@ fi
# Guess toolchains
[[ $platform == fx9860g && -z $toolchain ]] && toolchain=sh3eb-elf
[[ $platform == fxcg50 && -z $toolchain ]] && toolchain=sh4eb-elf
[[ $platform == fx9860g && -z $toolchain ]] && toolchain=sh-elf
[[ $platform == fxcg50 && -z $toolchain ]] && toolchain=sh-elf
# Guess compiler paths

View File

@ -31,6 +31,13 @@
#define TEX_PRINT
#endif
/* Switch to change parameters on fx-9860G / fx-CG 50. */
#if defined(TEX_PLATFORM_FX9860G)
#define TEX_FX(fx, cg) (fx)
#elif defined(TEX_PLATFORM_FXCG50)
#define TEX_FX(fx, cg) (cg)
#endif
//---
// Graphical settings
// A few quirks that can be adjusted to your needs.
@ -47,9 +54,13 @@
/* Vertical spacing between fraction bar and operands */
#define TEX_FRACTION_SPACING TEX_LAYOUT_SPACING
/* Vertical placement of subscripts and superscripts (relative to object) */
#define TEX_SUBSCRIPT_ELEVATION 3
#define TEX_SUPERSCRIPT_DEPTH 3
/* Vertical placement of subscripts and superscripts (relative to object) when
there is either only the subscript or only the superscript */
#define TEX_SUBSCRIPT_EXCL_ELEVATION TEX_FX(3, 5)
#define TEX_SUPERSCRIPT_EXCL_DEPTH TEX_FX(3, 5)
/* Vertical placement of subscripts and superscripts when there's both */
#define TEX_SUBSCRIPT_SHARED_ELEVATION TEX_FX(3, 3)
#define TEX_SUPERSCRIPT_SHARED_DEPTH TEX_FX(3, 3)
/* Horizontal spacing between object and subscripts and superscripts */
#define TEX_SUBSCRIPT_SPACING TEX_LAYOUT_SPACING
#define TEX_SUPERSCRIPT_SPACING TEX_LAYOUT_SPACING

View File

@ -146,7 +146,9 @@ static void chunk_layout_inline(struct chunk *chunk)
if(sub)
{
int elevation = TEX_SUBSCRIPT_ELEVATION;
int elevation = sup
? TEX_SUBSCRIPT_SHARED_ELEVATION
: TEX_SUBSCRIPT_EXCL_ELEVATION;
sub->x = base->x + base->width + TEX_SUBSCRIPT_SPACING;
sub->l = base->l + (base->height - base->line + sub->line -
@ -157,7 +159,9 @@ static void chunk_layout_inline(struct chunk *chunk)
}
if(sup)
{
int depth = TEX_SUPERSCRIPT_DEPTH;
int depth = sub
? TEX_SUPERSCRIPT_SHARED_DEPTH
: TEX_SUPERSCRIPT_EXCL_DEPTH;
sup->x = base->x + base->width + TEX_SUPERSCRIPT_SPACING;
sup->l = base->l - (base->line + (sup->height - sup->line) -