Skip to content
New issue

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

Issue 1139: Patch fixing text2image's --only_extract_font_properties mode to print variant kerning spacing #7

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
8 changes: 4 additions & 4 deletions training/text2image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@ static string StringReplace(const string& in,
// Renders the bigrams and calls FontInfo::GetSpacingProperties() to
// obtain spacing information. Produces the output .fontinfo file with a line
// per unichar of the form:
// unichar space_before space_after kerned1 kerned_space1 kerned2 ...
// unichar space_before space_after kerned_number kerned1 kerned_space1 kerned2 ...
// Fox example, if unichar "A" has spacing of 0 pixels before and -1 pixels
// after, is kerned with "V" resulting in spacing of "AV" to be -7 and kerned
// with "T", such that "AT" has spacing of -5, the entry/line for unichar "A"
// in .fontinfo file will be:
// A 0 -1 T -5 V -7
// A 0 -1 2 T -5 V -7
void ExtractFontProperties(const string &utf8_text,
StringRenderer *render,
const string &output_base) {
Expand Down Expand Up @@ -274,8 +274,8 @@ void ExtractFontProperties(const string &utf8_text,
spacing_map_it1 = spacing_map.find(ch1);
++ok_count;
}
if (ok_count == 2 && xgap != (spacing_map_it0->second.x_gap_after +
spacing_map_it1->second.x_gap_before)) {
if (xgap != (spacing_map_it0->second.x_gap_after +
spacing_map_it1->second.x_gap_before)) {
spacing_map_it0->second.kerned_x_gaps[ch1] = xgap;
}
}
Expand Down