|
|
@@ -71,6 +71,7 @@ final class CVTemplatePreviewView: NSView {
|
|
71
|
71
|
super.init(frame: .zero)
|
|
72
|
72
|
wantsLayer = true
|
|
73
|
73
|
translatesAutoresizingMaskIntoConstraints = false
|
|
|
74
|
+ userInterfaceLayoutDirection = .leftToRight
|
|
74
|
75
|
configurePaper()
|
|
75
|
76
|
}
|
|
76
|
77
|
|
|
|
@@ -100,6 +101,7 @@ final class CVTemplatePreviewView: NSView {
|
|
100
|
101
|
|
|
101
|
102
|
let root = buildResumeRoot()
|
|
102
|
103
|
root.translatesAutoresizingMaskIntoConstraints = false
|
|
|
104
|
+ enforceLeftToRightLayout(on: root)
|
|
103
|
105
|
paper.addSubview(root)
|
|
104
|
106
|
NSLayoutConstraint.activate([
|
|
105
|
107
|
root.leadingAnchor.constraint(equalTo: paper.leadingAnchor, constant: 7),
|
|
|
@@ -894,7 +896,7 @@ final class CVTemplatePreviewView: NSView {
|
|
894
|
896
|
row.orientation = .horizontal
|
|
895
|
897
|
row.spacing = 5
|
|
896
|
898
|
row.translatesAutoresizingMaskIntoConstraints = false
|
|
897
|
|
- let lab = makeLabel("PORTFOLIO SNAPSHOT", font: .systemFont(ofSize: 6.5, weight: .black), color: palette.previewInk, alignment: .left, maxLines: 1)
|
|
|
899
|
+ let lab = makeLabel(L("PORTFOLIO SNAPSHOT"), font: .systemFont(ofSize: 6.5, weight: .black), color: palette.previewInk, alignment: .left, maxLines: 1)
|
|
898
|
900
|
row.addArrangedSubview(stripe)
|
|
899
|
901
|
row.addArrangedSubview(lab)
|
|
900
|
902
|
v.addSubview(row)
|
|
|
@@ -1002,6 +1004,13 @@ final class CVTemplatePreviewView: NSView {
|
|
1002
|
1004
|
return row
|
|
1003
|
1005
|
}
|
|
1004
|
1006
|
|
|
|
1007
|
+ private func enforceLeftToRightLayout(on view: NSView) {
|
|
|
1008
|
+ view.userInterfaceLayoutDirection = .leftToRight
|
|
|
1009
|
+ for child in view.subviews {
|
|
|
1010
|
+ enforceLeftToRightLayout(on: child)
|
|
|
1011
|
+ }
|
|
|
1012
|
+ }
|
|
|
1013
|
+
|
|
1005
|
1014
|
private func makeLabel(
|
|
1006
|
1015
|
_ text: String,
|
|
1007
|
1016
|
font: NSFont,
|
|
|
@@ -1016,6 +1025,7 @@ final class CVTemplatePreviewView: NSView {
|
|
1016
|
1025
|
tf = NSTextField(wrappingLabelWithString: text)
|
|
1017
|
1026
|
tf.maximumNumberOfLines = maxLines
|
|
1018
|
1027
|
}
|
|
|
1028
|
+ tf.translatesAutoresizingMaskIntoConstraints = false
|
|
1019
|
1029
|
tf.font = font
|
|
1020
|
1030
|
tf.textColor = color
|
|
1021
|
1031
|
tf.alignment = alignment
|
|
|
@@ -1024,6 +1034,15 @@ final class CVTemplatePreviewView: NSView {
|
|
1024
|
1034
|
tf.drawsBackground = false
|
|
1025
|
1035
|
tf.isBordered = false
|
|
1026
|
1036
|
tf.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
|
|
1037
|
+ let paragraph = NSMutableParagraphStyle()
|
|
|
1038
|
+ paragraph.alignment = alignment
|
|
|
1039
|
+ paragraph.baseWritingDirection = .leftToRight
|
|
|
1040
|
+ paragraph.lineBreakMode = maxLines == 1 ? .byTruncatingTail : .byWordWrapping
|
|
|
1041
|
+ tf.attributedStringValue = NSAttributedString(string: text, attributes: [
|
|
|
1042
|
+ .font: font,
|
|
|
1043
|
+ .foregroundColor: color,
|
|
|
1044
|
+ .paragraphStyle: paragraph
|
|
|
1045
|
+ ])
|
|
1027
|
1046
|
return tf
|
|
1028
|
1047
|
}
|
|
1029
|
1048
|
}
|