mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-28 05:39:35 +08:00
Fix function Classify::CreateIntTemplates (issue #3925)
The old code did not work correctly if FClass->font_set.size() was 0. It created the FontSet fs with size 1 instead of 0. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
6b7cb1cbc6
commit
f969ba9161
@ -505,9 +505,11 @@ INT_TEMPLATES_STRUCT *Classify::CreateIntTemplates(CLASSES FloatProtos,
|
||||
}
|
||||
assert(UnusedClassIdIn(IntTemplates, ClassId));
|
||||
IClass = new INT_CLASS_STRUCT(FClass->NumProtos, FClass->NumConfigs);
|
||||
FontSet fs{FClass->font_set.size()};
|
||||
for (unsigned i = 0; i < fs.size(); ++i) {
|
||||
fs[i] = FClass->font_set.at(i);
|
||||
unsigned fs_size = FClass->font_set.size();
|
||||
FontSet fs;
|
||||
fs.reserve(fs_size);
|
||||
for (unsigned i = 0; i < fs_size; ++i) {
|
||||
fs.push_back(FClass->font_set.at(i));
|
||||
}
|
||||
IClass->font_set_id = this->fontset_table_.push_back(fs);
|
||||
AddIntClass(IntTemplates, ClassId, IClass);
|
||||
|
Loading…
Reference in New Issue
Block a user