Commit graph

3298 commits

Author SHA1 Message Date
Daniel Eklöf
f7669c1e24
box-drawing: quadrants: convert quad_*() macros to functions
This reduces the size of the foot binary by ~4K; all the quad
macros called ceil() and floor() twice per macro, which caused many
float -> int -> float conversions in the expanded code.

By using functions instead, there’s no expansion - the conversion only
happens in one (well, four) places.
2021-01-01 21:56:53 +01:00
Daniel Eklöf
c75192b4f8
box-drawing: reduce number of function arguments
We were using so many function arguments that a lot of the emitted
code was just stack push and pops to pass around arguments.

Bundle the buffer data, width, height, stride, and current DPI, into a
single ‘buf’ argument. This greatly reduces the number of arguments to
all functions.
2021-01-01 21:47:05 +01:00
Daniel Eklöf
25f21d4202
box-drawing: force minsize optimization 2021-01-01 21:28:12 +01:00
Daniel Eklöf
11d4e9ee53
box-drawing: disable debug output 2021-01-01 21:27:53 +01:00
Daniel Eklöf
71d187119f
changelog: box drawing characters are rendered by foot 2021-01-01 21:09:39 +01:00
Daniel Eklöf
81ac95995a
box-drawing: LIGHT DIAGONALs
* U+2571
* U+2572
* U+2573
2021-01-01 21:09:39 +01:00
Daniel Eklöf
ca423bcb01
box-drawing: silence variable-may-not-be-initialized warnings 2021-01-01 21:09:38 +01:00
Daniel Eklöf
ebb5e9eeae
box-drawing: LIGHT/HEAVY DOUBLE/TRIPLE/QUADRUPLE VERTICAL
Also combine the HORIZONTAL versions into a single draw function.

* U+2506
* U+2507
* U+250A
* U+250B
* U+254E
* U+254F
2021-01-01 21:09:38 +01:00
Daniel Eklöf
34360fbb7d
box-drawing: LIGHT/HEAVY DOUBLE/TRIPLE/QUADRUPLE HORIZONTAL
*U+2504
*U+2505
*U+2508
*U+2509
*U+254C
*U+254D
2021-01-01 21:09:38 +01:00
Daniel Eklöf
848bd27dd5
box-drawing: LIGHT ARC: improve symmetry when cell width is even 2021-01-01 21:09:38 +01:00
Daniel Eklöf
167078c076
box-drawing: LIGHT ARC: no need to do floating point since we’re truncating 2021-01-01 21:09:38 +01:00
Daniel Eklöf
56e947bb44
box-drawing: LIGHT ARC: pixel-perfect
At least in odd-sized cells, with a thickness of 1 pixel.
2021-01-01 21:09:38 +01:00
Daniel Eklöf
c120e0c84f
box-drawing: wip: LIGHT ARC: U+256d-U+2570 2021-01-01 21:09:37 +01:00
Daniel Eklöf
bd42986a8b
box-drawing: {h,v}line(): handle both start/end point being too small *and* too large 2021-01-01 21:09:37 +01:00
Daniel Eklöf
a8496eef03
box-drawing: thickness(): ensure thickness is *at least* 1px 2021-01-01 21:09:37 +01:00
Daniel Eklöf
878adb970e
box-drawing: make sure we never walk outside the (image) buffer 2021-01-01 21:09:37 +01:00
Daniel Eklöf
b5ec34ca12
box-drawing: wrap {h,v}hline() functions in macros, to shorten argument list
Rename the *function* {h,v}line() to _{h,v}line(), and add two new
macros: hline() and vline().

This allows us to shorten the argument list by removing the ‘buf’ and
‘stride’ arguments.
2021-01-01 21:09:37 +01:00
Daniel Eklöf
25d2b03a5c
box-drawing: SEXTANTS, U+1fb00-1fb3b 2021-01-01 21:09:37 +01:00
Daniel Eklöf
00d0e53a95
box-drawing: oops - remove accidental ‘x’ 2021-01-01 21:09:37 +01:00
Daniel Eklöf
4ac33f4f4e
box-drawing: remove LOG_WARN from U+259x range - all codepoints have been implemented 2021-01-01 21:09:36 +01:00
Daniel Eklöf
705cb9cfb0
box_drawing(): mark function as ‘cold’ 2021-01-01 21:09:36 +01:00
Daniel Eklöf
5b167bd185
box-drawing: remove __attribute__((__const__)) from thickness()
thickness() is a static function and thus ‘const’ is not necessary.
2021-01-01 21:09:36 +01:00
Daniel Eklöf
cf0270c1ea
box-drawing: make ‘term’ parameter const 2021-01-01 21:09:36 +01:00
Daniel Eklöf
44f365bd00
box-drawing: DOUBLE lines, U+2550-U+256C 2021-01-01 21:09:36 +01:00
Daniel Eklöf
2d4185567c
box-drawing: LIGHT/MEDIUM/DARK SHADE
* U+2591
* U+2592
* U+2593
2021-01-01 21:09:36 +01:00
Daniel Eklöf
17a46378bf
box-drawing: QUADRANTs: ensure all quads have equal width and hight
If the cell width/height is odd, the previous implementation would
result in uneven quads.
2021-01-01 21:09:35 +01:00
Daniel Eklöf
ddc997dd5e
box-drawing: QUADRANTs
* U+2596
* U+2597
* U+2598
* U+2599
* U+259A
* U+259B
* U+259C
* U+259D
* U+259E
* U+259F
2021-01-01 21:09:35 +01:00
Daniel Eklöf
bca7c75393
box-drawing: RIGHT HALF, UPPER ONE EIGHTH and RIGHT ONE EIGTH
* U+2590
* U+2594
* U+2595
2021-01-01 21:09:35 +01:00
Daniel Eklöf
08280553b5
box-drawing: use floating point math, and round(), when drawing block elements
This is especially important for the LEFT xxx BLOCK characters, since
cells can be quite narrow, and one eighth is not a lot...
2021-01-01 21:09:35 +01:00
Daniel Eklöf
013253a20b
box-drawing: first half of the block elements, U+2580-U+258F 2021-01-01 21:09:35 +01:00
Daniel Eklöf
0c263be815
box-drawing: mixed LIGHT/HEAVY HORIZONTAL, VERTICAL
* U+257C
* U+257D
* U+257E
* U+257F
2021-01-01 21:09:34 +01:00
Daniel Eklöf
b001b7d27b
box-drawing: use #defines for LIGHT and HEAVY thicknesses 2021-01-01 21:09:34 +01:00
Daniel Eklöf
f2add75895
box-drawing: hline/vline macros now call thickness() 2021-01-01 21:09:34 +01:00
Daniel Eklöf
8b1e702827
box-drawing: thickness(): tag as CONST, convert point-size to a float 2021-01-01 21:09:34 +01:00
Daniel Eklöf
973a57a096
macros: add CONST (__attribute((__const__))) 2021-01-01 21:09:34 +01:00
Daniel Eklöf
c1cc75051f
box-drawing: LIGH/HEAVY LEFT, UP, RIGTH, DOWN
* U+2574
* U+2575
* U+2576
* U+2577
* U+2578
* U+2579
* U+257A
* U+257B
2021-01-01 21:09:33 +01:00
Daniel Eklöf
9a1e299cad
box-drawing: mixed LIGHT/HEAVY variants of VERTICAL AND HORIZONTAL
* U+253D
* U+253E
* U+253F
* U+2540
* U+2541
* U+2542
* U+2542
* U+2543
* U+2544
* U+2545
* U+2546
* U+2547
* U+2548
* U+2549
* U+254A
2021-01-01 21:09:33 +01:00
Daniel Eklöf
011c58f759
box-drawing: mixed LIGHT/HEAVY variants of UP AND HORIZONTAL
* U+2535
* U+2536
* U+2537
* U+2538
* U+2539
* U+253A
2021-01-01 21:09:33 +01:00
Daniel Eklöf
20c9a0a918
box-drawing: mixed LIGHT/HEAVY variants of DOWN AND HORIZONTAL
* U+252d
* U+252e
* U+252f
* U+2530
* U+2531
* U+2532
2021-01-01 21:09:33 +01:00
Daniel Eklöf
fe54fcc694
box-drawing: mixed LIGHT/HEAVY variants of VERTICAL AND LEFT
* U+2525
* U+2526
* U+2527
* U+2528
* U+2529
* U+252A
2021-01-01 21:09:33 +01:00
Daniel Eklöf
56920558d6
box-drawing: add mixed LIGHT/HEAVY VERTICAL AND RIGHT
* U+251D
* U+251E
* U+251F
* U+2520
* U+2521
* U+2522
2021-01-01 21:09:32 +01:00
Daniel Eklöf
42e22027ef
box-drawing: add mixed LIGHT/HEAVY corners
* U+250D
* U+250E
* U+2511
* U+2512
* U+2515
* U+2516
* U+2519
* U+251A
2021-01-01 21:09:32 +01:00
Daniel Eklöf
a692ecf656
box-drawing: add {h,v}line_middle_{left,right,up,down} primitives
All solid lines LIGHT/HEAVY line drawings implemented so far can be
implemented in terms of these.
2021-01-01 21:09:32 +01:00
Daniel Eklöf
4f6595c0f3
box-drawing: HEAVY versions of solid lines 2021-01-01 21:09:32 +01:00
Daniel Eklöf
032da5b14e
box-drawing: break out thickness calculation 2021-01-01 21:09:32 +01:00
Daniel Eklöf
fc95c7f48c
box-drawing: initial set of LIGHT box drawings
* 2500
* 2502
* 250c
* 2510
* 2514
* 2518
* 251c
* 2524
* 252c
* 2534
* 253c
2021-01-01 21:09:31 +01:00
Daniel Eklöf
736c88c3fb
term: clear box drawing glyph cache when reloading fonts 2021-01-01 21:09:31 +01:00
Daniel Eklöf
92dc581bea
box-drawing: fix compilation error on 32-bit; wc is int on 64-bit, long on 32-bit 2021-01-01 21:09:31 +01:00
Daniel Eklöf
7acdb3a0dd
box-drawing: add infrastructure for rendering box drawing characters ourselves
* ‘term’ struct contains an array of 160 fcft glyph pointers
* the glyph pointers are lazily allocated when we need to draw a box
  drawings character
* Filtering out box drawings characters is easy - they are (except
  unicode 13, which isn’t handled yet )all in a single range.
2021-01-01 21:09:31 +01:00
Daniel Eklöf
44b32104a7
doc: foot.ini: remove FONT FORMAT section, expand description of ‘font’ 2020-12-31 12:57:37 +01:00