Fix problem in font size application to annotations

This commit is contained in:
Gaute Lindkvist
2019-04-12 12:05:34 +02:00
parent 9d06b59357
commit 9834a421c8

View File

@@ -295,9 +295,9 @@ bool RimGridView::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType
bool hasCustomFonts = Rim3dView::hasCustomFontSizes(fontSettingType, defaultFontSize);
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
{
auto annotations = annotationCollection();
RiaFontCache::FontSize oldFontSize = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
hasCustomFonts = annotations->hasTextAnnotationsWithCustomFontSize(oldFontSize) || hasCustomFonts;
auto annotations = annotationCollection();
RiaFontCache::FontSize defaultFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(defaultFontSize);
hasCustomFonts = annotations->hasTextAnnotationsWithCustomFontSize(defaultFontSizeEnum) || hasCustomFonts;
}
return hasCustomFonts;
}
@@ -314,13 +314,13 @@ bool RimGridView::applyFontSize(RiaDefines::FontSettingType fontSettingType,
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
{
auto annotations = annotationCollection();
RiaFontCache::FontSize oldFontSize = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
RiaFontCache::FontSize newFontSize = RiaFontCache::fontSizeEnumFromPointSize(fontSize);
bool applyFontSizes = forceChange || !annotations->hasTextAnnotationsWithCustomFontSize(oldFontSize);
RiaFontCache::FontSize oldFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
RiaFontCache::FontSize newFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(fontSize);
bool applyFontSizes = forceChange || !annotations->hasTextAnnotationsWithCustomFontSize(oldFontSizeEnum);
if (applyFontSizes)
{
anyChange = annotations->applyFontSizeToAllTextAnnotations(oldFontSize, newFontSize, forceChange) || anyChange;
anyChange = annotations->applyFontSizeToAllTextAnnotations(oldFontSizeEnum, newFontSizeEnum, forceChange) || anyChange;
}
}
return anyChange;