You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In egui 0.21.0, the font size was aligned correctly in TextEdit (multiline) with the following code:
let row_height = ui.fonts(|f| f.row_height(&font_id));
Therefore, it worked well with ui.scroll_with_delta() as well. Additionally, the sizes of TextEdit and ui.label() were aligned properly when using ui.spacing_mut().item_spacing.y = 0.0 with matching font sizes.
However, in egui 0.22.0, there is a significant mismatch in sizes. To mitigate this, I tried the following code to adjust the row height:
let row_height = ui.fonts(|f| f.row_height(&font_id)) + 0.14;
But even with this adjustment, there is still a slight discrepancy in ui.scroll_with_delta() and other functions.
Moreover, in egui 0.22.0, when trying to align the sizes of TextEdit and ui.label(), I used the following code:
let font_id = egui::FontId::monospace( font_size );
let row_height = ui.fonts(|f| f.row_height(&font_id));
ui.spacing_mut().item_spacing.y = row_height * 0.0043;
However, even with this adjustment, there are minor discrepancies in sizes. Please note that you may need to have more than 1000 lines to observe these small discrepancies.
And depending on the font size, the magnitude of the minor discrepancy varies.
Although these discrepancies are very small, they can cause issues in practical applications, even though egui can be used to create simple programs without problems.
If you haven't already addressed these issues, I kindly request you to make the necessary adjustments to resolve them.
Thanks.
The text was updated successfully, but these errors were encountered:
How to fix egui:
(1) row_height() returns the same value as TextEdit, or
Create a new function so you can get the row_height value.
(2) And, make the size of row_height of TextEdit and row_height of ui.label().
I create a function to get row_height directly in my program,
I solved it by using ui.add_sized() in ui.label().
The height of a row of text is not fixed, but depends on the characters in it. If you want to know the sizes of the rows in the TextEdit, use TextEditOutput::galley. There you will find all the rows of text and where they are.
The height of a row of text is not fixed, but depends on the characters in it. If you want to know the sizes of the rows in the TextEdit, use TextEditOutput::galley. There you will find all the rows of text and where they are.
Thanks emilk.
I solved it the way you told me.
content.editor_row_height_vec.clear();
for i in 0..output.galley.rows.len() {
content.editor_row_height_vec.push( output.galley.rows[i].height() );
}
Dear emilk,
In egui 0.21.0, the font size was aligned correctly in TextEdit (multiline) with the following code:
let row_height = ui.fonts(|f| f.row_height(&font_id));
Therefore, it worked well with
ui.scroll_with_delta()
as well. Additionally, the sizes ofTextEdit
andui.label()
were aligned properly when usingui.spacing_mut().item_spacing.y = 0.0
with matching font sizes.However, in egui 0.22.0, there is a significant mismatch in sizes. To mitigate this, I tried the following code to adjust the row height:
let row_height = ui.fonts(|f| f.row_height(&font_id)) + 0.14;
But even with this adjustment, there is still a slight discrepancy in ui.scroll_with_delta() and other functions.
Moreover, in egui 0.22.0, when trying to align the sizes of TextEdit and ui.label(), I used the following code:
However, even with this adjustment, there are minor discrepancies in sizes. Please note that you may need to have more than 1000 lines to observe these small discrepancies.
And depending on the font size, the magnitude of the minor discrepancy varies.
Although these discrepancies are very small, they can cause issues in practical applications, even though egui can be used to create simple programs without problems.
If you haven't already addressed these issues, I kindly request you to make the necessary adjustments to resolve them.
Thanks.
The text was updated successfully, but these errors were encountered: