From 6a44b95751a8e16f6554884f63f76eb2d7b90f2e Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 8 Apr 2014 17:10:45 -0400 Subject: [PATCH] Fix text2image's --only_extract_font_properties mode to print variant kerning spacing The ok_count == 2 part of the test always failed, which prevented the kerning variations from ever being printed. As far as I can tell it wasn't doing anything useful, but my C++ is (still) rusty, so some light checking would be wise. Also updates the function description to be in line with the current output --- training/text2image.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/training/text2image.cpp b/training/text2image.cpp index d3b2c712f7..6430f562cc 100644 --- a/training/text2image.cpp +++ b/training/text2image.cpp @@ -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) { @@ -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; } }