CARTAvis / carta-frontend

Source code repository for the frontend component of CARTA, a new visualization tool designed for the ALMA, the VLA and the SKA pathfinders.
https://cartavis.github.io/
GNU General Public License v3.0
19 stars 10 forks source link

Inconsistency in AST wrapper font ordering pattern #2339

Open confluence opened 6 months ago

confluence commented 6 months ago

This is how the mapping of numeric font IDs to font families and styles is defined in post.ts:

Module.fonts = [
    "{size} sans-serif",
    "italic {size} sans-serif",
    "bold {size} sans-serif",
    "bold italic {size} sans-serif",
    "{size} times",
    "italic {size} times",
    "bold {size} times",
    "bold italic {size} times",
    "{size} arial",
    "bold {size} arial",
    "italic {size} arial",
    "bold italic {size} arial",
    "{size} palatino",
    "italic {size} palatino",
    "bold {size} palatino",
    "bold italic {size} palatino",
    "{size} courier new",
    "italic {size} courier new",
    "bold {size} courier new",
    "bold italic {size} courier new"
];

The styles are ordered in a consistent pattern (normal, italic, bold, bold italic), except for Arial, which swaps italic and bold. In the Python wrapper's API, family and style constants are mapped to a font ID and vice versa with a simple calculation, but for now I have to add a special workaround to swap these two IDs. Would it be possible to fix this? As far as I can see, the overlay font menus are automatically generated from this array, and the values are taken from these menus, so the only effect would be that the items would be swapped in the menus.

veggiesaurus commented 6 months ago

please forgive me @confluence πŸ˜†

confluence commented 6 months ago

I was so sure my maths was correct. And it was, but for the one font that didn't match the others. πŸ˜€

kswang1029 commented 6 months ago

Sorry for not picking this up for so long. Now I am developing e2e tests for viewer settings via the Python wrapper to widen the test coverage.