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 <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-07-22 09:17:42 -05:00
parent b9082ac1d2
commit d00b1d0a0e
3 changed files with 22 additions and 5 deletions

View File

@ -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;

View File

@ -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
}

View File

@ -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