isl-org / isl-org/Open3D

How to adjust text size when using gui.Label() method?

Open
#5,228 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### My Question

My request is that draw a window and show some text info at the left-top corner of the window, and I use **gui.Label('label_name')** to realize this.
But the **text size is too small for the whole window**, I checked the document about gui.Label and search the issues and then found that there was no method to adjust text size directly (but there was a method about gui.label3D, but this method not fit my request), so I want to ask is there any method to adjust label text size?

Below is the pseudo-code

```import open3d as o3d
import open3d.visualization.gui as gui
import open3d.visualization.rendering as rendering

gui.Application.instance.initialize()
self.window = gui.Application.instance.create_window('Example', width=1200, height=800)
self.widget = gui.SceneWidget()
self.widget.scene = rendering.Open3DScene(self.window.renderer)
self.widget.scene.set_background([0, 0, 0, 1])
self.window.add_child(self.widget)

em = self.window.theme.font_size
self._timestamp_text = gui.Label('TimeStamp')
self._timestamp_text.text_color = gui.Color(0.0, 1.0, 0.0)
horizon_layout = gui.Horiz()
horizon_layout.add_child(self._timestamp_text)
vertical_layout = gui.Vert()
vertical_layout.add_fixed(0.5 *em)
vertical_layout.add_child(horizon_layout)
self.window.add_child(vertical_layout)
```

And the visualization result like:
![Screenshot from 2022-06-21 15-12-29](https://user-images.githubusercontent.com/14069568/174739093-1e3e9d07-680e-44e0-aff7-ac840fe42c07.png)

It seems that text info font size is too small relative to thole window.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the gui.Label documentation and the shown use of window.theme.font_size. Trace the GUI label and theme entry points to determine whether label-specific sizing is supported. Done means providing or documenting a way to make gui.Label text larger than the current window theme size, with suitable coverage for the Python API.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
computer-graphics, desktop-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.