From d00b1d0a0ec35b3f62d9c225c0ab6bac52756879 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Sat, 22 Jul 2023 09:17:42 -0500 Subject: [PATCH] updated makeAttributedString to use min lineHeight as well as read a var to help determine if this is really needed or not Signed-off-by: Matt Bruce --- VDS.xcodeproj/project.pbxproj | 4 ++-- VDS/Extensions/NSAttributedString.swift | 10 +++++++++- VDS/SupportingFiles/ReleaseNotes.txt | 13 +++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 77fc4990..e320cb6c 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -1163,7 +1163,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 31; + CURRENT_PROJECT_VERSION = 32; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1200,7 +1200,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 31; + CURRENT_PROJECT_VERSION = 32; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; diff --git a/VDS/Extensions/NSAttributedString.swift b/VDS/Extensions/NSAttributedString.swift index 871f6b18..49f39f45 100644 --- a/VDS/Extensions/NSAttributedString.swift +++ b/VDS/Extensions/NSAttributedString.swift @@ -19,8 +19,13 @@ extension NSAttributedString { } extension NSMutableAttributedString { + + public static var useMinimumLineHeight: Bool = true public static func mutableText(for text: String, textStyle: TextStyle, useScaledFont: Bool = true, textColor: UIColor, alignment: NSTextAlignment = .left, lineBreakMode: NSLineBreakMode) -> NSMutableAttributedString { + //var for if you can scale or not + let scaledMode = useScaledFont && TextStyle.canScaleFonts + //create the paragraph for specific properties let paragraph = NSMutableParagraphStyle() paragraph.alignment = alignment @@ -29,13 +34,16 @@ extension NSMutableAttributedString { var defaultFont = textStyle.font var lineHeight = textStyle.lineHeight - if useScaledFont { + if scaledMode { lineHeight = textStyle.scaledLineHeight defaultFont = defaultFont.scaledFont } //set lineHeight if textStyle.lineHeight > 0.0 { + if useMinimumLineHeight { + paragraph.minimumLineHeight = lineHeight + } paragraph.maximumLineHeight = lineHeight } diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 0401f37d..f587beb6 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,11 +1,20 @@ +1.0.32 +======= +- Fixed bug dealing with Scaled +- Added ability to use minimumLineheight in Paragraph for AttributedString creation + 1.0.31 ======= -- Upated Label to allow Scaled Fonts +- updated version only + +1.0.30 +======= +- Updated Label to allow Scaled Fonts - Refactored Code TextStyle 1.0.29 ======= -- Upated TextStyle and Label for dealing with Top/Bottom insets +- Updated TextStyle and Label for dealing with Top/Bottom insets - Refactored Code for Checkbox/RadioButton/Toggle 1.0.28