We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug Cheat sheet is not resized properly in the vertical direction
To Reproduce Steps to reproduce the behavior:
f3d --dry-run example.glb
H
Expected behavior Font size should be reduced so the text fits. This work correctly in the horizontal direction
This is possibly a bug in VTK's CornerAnnotation where some edge texts are not taken into account when computing the font size: https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Annotation/vtkCornerAnnotation.cxx?ref_type=heads#L459-490
CornerAnnotation
The following diff makes the code look more correct and seems to mitigate this specific issue in F3D but I wouldn't claim it's the real bug fix.
diff --git a/Rendering/Annotation/vtkCornerAnnotation.cxx b/Rendering/Annotation/vtkCornerAnnotation.cxx index 39d1a307bc..4b8a5fd0ae 100644 --- a/Rendering/Annotation/vtkCornerAnnotation.cxx +++ b/Rendering/Annotation/vtkCornerAnnotation.cxx @@ -481,31 +481,32 @@ int vtkCornerAnnotation::RenderOpaqueGeometry(vtkViewport* viewport) return 0; } - int height_02 = tempi[1] + tempi[5]; // total height of text in left top/bottom corners - int height_13 = tempi[3] + tempi[7]; // total height of text in right top/bottom corners - int height_47 = tempi[9] + tempi[15]; // total height of text at center of top/bottom edges - - int width_01 = tempi[0] + tempi[2]; // total width of text on bottom left/right corners - int width_23 = tempi[4] + tempi[6]; // total width of text on top left/right corners - int width_56 = tempi[10] + tempi[12]; // total width of text at center of left/right edges - - int max_width_corners = (width_01 > width_23) ? width_01 : width_23; + int height_026 = tempi[1] + tempi[5] + tempi[13]; // total height of text in left + int height_135 = tempi[3] + tempi[7] + tempi[11]; // total height of text in right + int height_47 = tempi[9] + tempi[15]; // total height of text at center + int width_014 = tempi[0] + tempi[2] + tempi[8]; // total width of text on bottom + int width_237 = tempi[4] + tempi[6] + tempi[14]; // total width of text on top + int width_56 = tempi[10] + tempi[12]; // total width of text at center + + int max_width_corners = (width_014 > width_237) ? width_014 : width_237; int max_width = (width_56 > max_width_corners) ? width_56 : max_width_corners; - int num_lines_02 = GetNumberOfLines(this->TextMapper[0]->GetInput()) + - GetNumberOfLines(this->TextMapper[2]->GetInput()); + int num_lines_026 = GetNumberOfLines(this->TextMapper[0]->GetInput()) + + GetNumberOfLines(this->TextMapper[2]->GetInput()) + + GetNumberOfLines(this->TextMapper[6]->GetInput()); - int num_lines_13 = GetNumberOfLines(this->TextMapper[1]->GetInput()) + - GetNumberOfLines(this->TextMapper[3]->GetInput()); + int num_lines_135 = GetNumberOfLines(this->TextMapper[1]->GetInput()) + + GetNumberOfLines(this->TextMapper[3]->GetInput()) + + GetNumberOfLines(this->TextMapper[5]->GetInput()); int num_lines_47 = GetNumberOfLines(this->TextMapper[4]->GetInput()) + GetNumberOfLines(this->TextMapper[7]->GetInput()); - int line_max_02 = - (int)(vSize[1] * this->MaximumLineHeight) * (num_lines_02 ? num_lines_02 : 1); + int line_max_026 = + (int)(vSize[1] * this->MaximumLineHeight) * (num_lines_026 ? num_lines_026 : 1); - int line_max_13 = - (int)(vSize[1] * this->MaximumLineHeight) * (num_lines_13 ? num_lines_13 : 1); + int line_max_135 = + (int)(vSize[1] * this->MaximumLineHeight) * (num_lines_135 ? num_lines_135 : 1); int line_max_47 = (int)(vSize[1] * this->MaximumLineHeight) * (num_lines_47 ? num_lines_47 : 1); @@ -518,8 +519,8 @@ int vtkCornerAnnotation::RenderOpaqueGeometry(vtkViewport* viewport) // While the size is too small increase it - while (height_02 < tSize[1] && height_13 < tSize[1] && height_47 < tSize[1] && - max_width < tSize[0] && height_02 < line_max_02 && height_13 < line_max_13 && + while (height_026 < tSize[1] && height_135 < tSize[1] && height_47 < tSize[1] && + max_width < tSize[0] && height_026 < line_max_026 && height_135 < line_max_135 && height_47 < line_max_47 && fontSize < 100) { fontSize++; @@ -528,22 +529,22 @@ int vtkCornerAnnotation::RenderOpaqueGeometry(vtkViewport* viewport) this->TextMapper[i]->GetTextProperty()->SetFontSize(fontSize); this->TextMapper[i]->GetSize(viewport, tempi + i * 2); } - height_02 = tempi[1] + tempi[5]; - height_13 = tempi[3] + tempi[7]; + height_026 = tempi[1] + tempi[5] + tempi[13]; + height_135 = tempi[3] + tempi[7] + tempi[11]; height_47 = tempi[9] + tempi[15]; - width_01 = tempi[0] + tempi[2]; - width_23 = tempi[4] + tempi[6]; + width_014 = tempi[0] + tempi[2] + tempi[8]; + width_237 = tempi[4] + tempi[6] + tempi[14]; width_56 = tempi[10] + tempi[12]; - max_width_corners = (width_01 > width_23) ? width_01 : width_23; + max_width_corners = (width_014 > width_237) ? width_014 : width_237; max_width = (width_56 > max_width_corners) ? width_56 : max_width_corners; } // While the size is too large decrease it - while ((height_02 > tSize[1] || height_13 > tSize[1] || height_47 > tSize[1] || - max_width > tSize[0] || height_02 > line_max_02 || height_13 > line_max_13 || + while ((height_026 > tSize[1] || height_135 > tSize[1] || height_47 > tSize[1] || + max_width > tSize[0] || height_026 > line_max_026 || height_135 > line_max_135 || height_47 > line_max_47) && fontSize > 0) { @@ -553,15 +554,15 @@ int vtkCornerAnnotation::RenderOpaqueGeometry(vtkViewport* viewport) this->TextMapper[i]->GetTextProperty()->SetFontSize(fontSize); this->TextMapper[i]->GetSize(viewport, tempi + i * 2); } - height_02 = tempi[1] + tempi[5]; - height_13 = tempi[3] + tempi[7]; + height_026 = tempi[1] + tempi[5] + tempi[13]; + height_135 = tempi[3] + tempi[7] + tempi[11]; height_47 = tempi[9] + tempi[15]; - width_01 = tempi[0] + tempi[2]; - width_23 = tempi[4] + tempi[6]; + width_014 = tempi[0] + tempi[2] + tempi[8]; + width_237 = tempi[4] + tempi[6] + tempi[14]; width_56 = tempi[10] + tempi[12]; - max_width_corners = (width_01 > width_23) ? width_01 : width_23; + max_width_corners = (width_014 > width_237) ? width_014 : width_237; max_width = (width_56 > max_width_corners) ? width_56 : max_width_corners; }
Comparison capture with current behavior on the left and tentative fix on the right:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Cheat sheet is not resized properly in the vertical direction
To Reproduce
Steps to reproduce the behavior:
f3d --dry-run example.glb
H
to show cheat sheetExpected behavior
Font size should be reduced so the text fits. This work correctly in the horizontal direction
This is possibly a bug in VTK's
CornerAnnotation
where some edge texts are not taken into account when computing the font size: https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Annotation/vtkCornerAnnotation.cxx?ref_type=heads#L459-490The following diff makes the code look more correct and seems to mitigate this specific issue in F3D but I wouldn't claim it's the real bug fix.
diff
Comparison capture with current behavior on the left and tentative fix on the right:
The text was updated successfully, but these errors were encountered: