Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/new_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Linux testing protocol:
- `cd examples/libf3d && mkdir build && cd build && cmake ../ && make`
- `./cpp/check-engine/check-engine`
- `./cpp/render-interact/render-interact ../../../testing/data/cow.vtp`
- Check that the font scale has been auto-scaled correctly when app launched

macOS testing protocol:

Expand All @@ -96,6 +97,7 @@ macOS testing protocol:
- Drag&Drop cow.vtp, Drag&Drop palermo_park.hdr, check render
- Check that CTRL+O (file dialog) is working
- Press "Esc" and check the following commands `reload_current_file_group`, `set_camera top`, `toggle_volume_rendering`, `exit`
- Check that the font scale has been auto-scaled correctly when app launched

Windows testing protocol:

Expand All @@ -115,6 +117,7 @@ Windows testing protocol:
- `cd examples\libf3d && mkdir build && cd build && cmake ../ && cmake --build . --config Release`
- `.\cpp\check-engine\Release\check-engine`
- `.\cpp\render-interact\Release\render-interact ..\..\..\testing\data\cow.vtp`
- Check that the font scale has been auto-scaled correctly when app launched

Python testing protocol:

Expand Down
2 changes: 2 additions & 0 deletions doc/user/03-OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ Can be useful to display non-ASCII filenames.
### `--font-scale=<ratio>` (_ratio_, default: `1.0`)

Scale fonts. Useful for HiDPI displays.
> [!NOTE]
> When font scale is not set (default to `1`), your actual font scale is automatically adjusted according to your screen DPI. For example, if your screen DPI is 72, your actual font size display on app should look like your font scale is set to `1.5` (Although if you use `print ui.scale` command on app console you will see the print value is `1`). To truly display font size to a ratio of `1`, you need to set the value to `1.001` (When ratio is set to any value other than `1`, the `print ui.scale` command will print actual font scale value that you set).

### `--command-script=<command script>` (_script_)

Expand Down
12 changes: 12 additions & 0 deletions vtkext/private/module/vtkF3DRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,18 @@ void vtkF3DRenderer::ConfigureTextActors()
F3DLog::Severity::Warning, std::string("Cannot find \"") + fontFileStr + "\" font file.");
}
}
// If font scale is set, use set value, otherwise adjust font scale by screen DPI
if (0.999 < this->FontScale && this->FontScale < 1.001)
{
vtkWindow* vtkWindow = this->GetVTKWindow();

const int dpi = vtkWindow->GetDPI();
const double base = 48.0;
// Default ratio to 1.5 when DPI = 72
const double adjustedScale = static_cast<double>(dpi) / base;

this->FontScale = adjustedScale;
}

this->UIActor->SetFontScale(this->FontScale);

Expand Down