gbranden pushed a commit to branch branden-2023-07-05 in repository groff. commit e90af1f7f4f253017a3ea32331d00bb5a2186e2d Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Fri May 19 00:27:34 2023 -0500
[eqn]: Add `thick_space` and `thin_space` classes. * src/preproc/eqn/box.cpp: * src/preproc/eqn/box.h: Do it. At present they are copy-and-paste jobs of `half_space` and `full_space`. But watch this space... --- ChangeLog | 7 +++++++ src/preproc/eqn/box.cpp | 37 +++++++++++++++++++++++++++++++++++++ src/preproc/eqn/box.h | 14 ++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/ChangeLog b/ChangeLog index a856f6068..ee23c75be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-05-19 G. Branden Robinson <g.branden.robin...@gmail.com> + + [eqn]: Add `thick_space` and `thin_space` classes. + + * src/preproc/eqn/box.cpp: + * src/preproc/eqn/box.h: Do it. + 2023-05-18 G. Branden Robinson <g.branden.robin...@gmail.com> [eqn]: Trivially refactor. Rename "space_box" class to diff --git a/src/preproc/eqn/box.cpp b/src/preproc/eqn/box.cpp index 4626409dd..d63c2800a 100644 --- a/src/preproc/eqn/box.cpp +++ b/src/preproc/eqn/box.cpp @@ -616,6 +616,33 @@ void full_space_box::output() printf("<mtext> </mtext>"); } +thick_space_box::thick_space_box() +{ + spacing_type = SUPPRESS_TYPE; +} + +void thick_space_box::output() +{ + if (output_format == troff) + printf("\\h'%dM'", thick_space); + else if (output_format == mathml) + //    doesn't display right under Firefox 1.5. + printf("<mtext> </mtext>"); +} + +thin_space_box::thin_space_box() +{ + spacing_type = SUPPRESS_TYPE; +} + +void thin_space_box::output() +{ + if (output_format == troff) + printf("\\h'%dM'", thin_space); + else if (output_format == mathml) + printf("<mtext> </mtext>"); +} + void box_list::list_debug_print(const char *sep) { p[0]->debug_print(); @@ -640,6 +667,16 @@ void full_space_box::debug_print() fprintf(stderr, "~"); } +void thick_space_box::debug_print() +{ + fprintf(stderr, "~"); +} + +void thin_space_box::debug_print() +{ + fprintf(stderr, "^"); +} + void tab_box::debug_print() { fprintf(stderr, "<tab>"); diff --git a/src/preproc/eqn/box.h b/src/preproc/eqn/box.h index b21e2e329..93277f3c0 100644 --- a/src/preproc/eqn/box.h +++ b/src/preproc/eqn/box.h @@ -182,6 +182,20 @@ public: void debug_print(); }; +class thick_space_box : public simple_box { +public: + thick_space_box(); + void output(); + void debug_print(); +}; + +class thin_space_box : public simple_box { +public: + thin_space_box(); + void output(); + void debug_print(); +}; + class tab_box : public box { int disabled; public: _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit