mirror of
https://github.com/tdulcet/Table-and-Graph-Libs.git
synced 2025-05-08 00:01:21 +08:00
using density array to get character dimensions
This commit is contained in:
parent
e0836b13a3
commit
afdd9a597b
15
graphs.hpp
15
graphs.hpp
@ -919,20 +919,7 @@ namespace graphs
|
|||||||
const long double y_term = ((long double)y - options.y.min) * y_span_recip * (long double)options.height;
|
const long double y_term = ((long double)y - options.y.min) * y_span_recip * (long double)options.height;
|
||||||
|
|
||||||
// calculate sub-fragment position (2x4 for braille)
|
// calculate sub-fragment position (2x4 for braille)
|
||||||
size_t char_width = 0;
|
const auto [char_width, char_height] = densities[options.character_set];
|
||||||
size_t char_height = 0;
|
|
||||||
// TODO: could put this in a separate function to avoid switch statement and reuse in other plot funcs
|
|
||||||
switch (options.character_set) {
|
|
||||||
case type_braille:
|
|
||||||
char_width = 2;
|
|
||||||
char_height = 4;
|
|
||||||
break;
|
|
||||||
case type_block_quadrant:
|
|
||||||
char_width = 2;
|
|
||||||
char_height = 2;
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
size_t x_sub = (x_term - std::floor(x_term)) * char_width;
|
size_t x_sub = (x_term - std::floor(x_term)) * char_width;
|
||||||
size_t y_sub = (y_term - std::floor(y_term)) * char_height;
|
size_t y_sub = (y_term - std::floor(y_term)) * char_height;
|
||||||
// invert y_sub
|
// invert y_sub
|
||||||
|
Loading…
Reference in New Issue
Block a user