Calculate row bounding box in single-word mode per #4304 #4305
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #4304 for full context.
In short,
ROW
objects are expected to have valid/accurate bounding boxes, which are accessed usingrow->bounding_box()
. However, bounding box values are not calculated automatically--the methodrow_obj->recalc_bounding_box()
must be run after the row is created and populated to calculate the bounding box. This happens correctly in 5 of the 6 instances wherenew ROW
is called, however does not occur in 1 case (within themake_single_word
function that runs whenpsm
isSINGLE_WORD
orSINGLE_CHAR
).This PR fixes this by adding the required call to
recalc_bounding_box
withinmake_single_word
. This brings that function in line with all the other functions that createROW
objects.This change fixes the bug described in #4304, where baselines are not correctly calculated when using certain
psm
settings. After implementing this fix, the motivating example in that issue is resolved, and the baseline is calculated correctly.