Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework package #4

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
081c98b
Remove comments.
sajacl Mar 18, 2024
24b2e1c
Remove extra white spaces.
sajacl Mar 18, 2024
3b80603
Revisit file in order to improve readability.
sajacl Mar 18, 2024
1201368
Introduce `ArabicStringEvaluator`.
sajacl Mar 18, 2024
19ec1d6
Introduce `ExtenderCharacter`.
sajacl Mar 18, 2024
a907f6f
Introduce `MiniSpaceCharacter `.
sajacl Mar 18, 2024
6b1ec6c
Introduce `NewLine `.
sajacl Mar 18, 2024
63fd8cb
Introduce `SpaceCharacter `.
sajacl Mar 18, 2024
a5e16ec
Introduce `Line`.
sajacl Mar 18, 2024
165a042
Introduce `Word`.
sajacl Mar 18, 2024
f93975f
Introduce `HeaderTypes`.
sajacl Mar 18, 2024
96ce0c4
Remove unneeded variables.
sajacl Mar 18, 2024
24ef91c
Introduce `splitStringToLines` method.
sajacl Mar 18, 2024
92e2724
Introduce `replaceDoubleEmptyLines` method.
sajacl Mar 18, 2024
9152d2b
Introduce `justify` method.
sajacl Mar 18, 2024
dea74ac
Remove `getJustifiedLine` method.
sajacl Mar 18, 2024
e126f60
Remove `getExtendedWords ` method.
sajacl Mar 18, 2024
57130d4
Remove `isArabic` computed property.
sajacl Mar 18, 2024
d78d161
Remove `getWords ` method.
sajacl Mar 18, 2024
8819450
Remove `getTotalWidth ` method.
sajacl Mar 18, 2024
d542b74
Remove `getWordWidth` method.
sajacl Mar 18, 2024
eaecc58
Remove `getRange ` method.
sajacl Mar 18, 2024
6fcb92f
Remove `isSupportExtender` method.
sajacl Mar 18, 2024
bcf1176
Remove `hasRoomForNextWord ` method.
sajacl Mar 18, 2024
ce47538
Remove `joinWithSpace ` method.
sajacl Mar 18, 2024
b328b5f
Introduce `justifyLine ` method.
sajacl Mar 18, 2024
871ac88
Refactor `toPJString` method.
sajacl Mar 18, 2024
c996e36
Add `MeasurementTests` file.
sajacl Mar 18, 2024
35e0daa
Introduce `MeasurementTests ` `UIKit` test case.
sajacl Mar 18, 2024
cc4c4bd
Introduce `MeasurementTests ` `AppKit ` test case.
sajacl Mar 18, 2024
69226c6
Set base line for `AppKit.MeasurementTests`.
sajacl Mar 18, 2024
aea4b04
Set base line for `UIKit.MeasurementTests`.
sajacl Mar 18, 2024
d96853a
Revisit [Word] extension.
sajacl Mar 18, 2024
c52ee61
Revisit `SpaceCharacter`.
sajacl Mar 18, 2024
37c7562
Update call site.
sajacl Mar 18, 2024
cb653a1
Revisit `NewLine`.
sajacl Mar 18, 2024
c3d52f2
Update call site.
sajacl Mar 18, 2024
cd7cceb
feat: Implemented "Create swift.yml" to add automated tests.
HappyIosDeveloper Mar 19, 2024
07857b9
feat: Updated the Swift tools version to "5.10.0" on iml file to help…
HappyIosDeveloper Mar 19, 2024
a6dc74b
GitHub: Downgraded the Swift tool version to fix the GitHub automatio…
HappyIosDeveloper Mar 19, 2024
fe45392
revert: Restored the Swift tool version to the 5.10 due to ruining th…
HappyIosDeveloper Mar 19, 2024
385c01e
Merge remote-tracking branch 'upstream/main' into rework-package
sajacl Mar 19, 2024
27e0a28
Adopt new method signature.
sajacl Mar 19, 2024
3039c71
Removed unused files.
sajacl Mar 19, 2024
937b3c5
Introduce new method `linesProcessing`.
sajacl Mar 19, 2024
60ac543
Update call site, remove foreach and use new method.
sajacl Mar 19, 2024
ccf2080
build: use release configurations for the tests
MojtabaHs Mar 21, 2024
26adb63
Revert "Introduce new method `linesProcessing`."
sajacl Mar 21, 2024
e794367
Revert "Update call site, remove foreach and use new method."
sajacl Mar 21, 2024
4a1d246
Merge remote-tracking branch 'upstream/main' into rework-package
sajacl Mar 21, 2024
e565ab4
Move `Typealias` file.
sajacl Mar 21, 2024
15a7621
Specify target path.
sajacl Mar 21, 2024
9660b7e
Update MesurementTests.swift
sajacl Mar 21, 2024
bfee432
Update MesurementTests.swift
sajacl Mar 21, 2024
5358f93
Add a new typealias named `Label`.
sajacl Mar 21, 2024
3f6f92a
Update method documentation.
sajacl Mar 21, 2024
e5db0c6
Remove default font argument value.
sajacl Mar 21, 2024
2cdb47b
Introduce new error `PersianJustifyFailure`.
sajacl Mar 21, 2024
39f66d8
Add new method on `Label` named `toPJString`.
sajacl Mar 21, 2024
1b85866
Decouple public interfaces from privates.
sajacl Mar 21, 2024
7b621d9
Remove `getFont` and related test methods.
sajacl Mar 21, 2024
84e8034
Add `debugDescription` for errorDescription in `PersianJustifyFailure`.
sajacl Mar 21, 2024
0fca2aa
Rename `PersianJustifyFailure` to `PersianJustifyError`.
sajacl Mar 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove getWordWidth method.
sajacl committed Mar 18, 2024
commit d542b74781c4b2b0672c9740841aba70d07ef439
11 changes: 0 additions & 11 deletions Sources/PersianJustify.swift
Original file line number Diff line number Diff line change
@@ -94,17 +94,6 @@ extension String {
}


func getWordWidth(font: Font, isRequiredSpace: Bool = true) -> CGFloat {
let text = isRequiredSpace ? (self + spaceCharacter.description) : self
let attributedString = NSAttributedString(string: text, attributes: [.font: font])
let line = CTLineCreateWithAttributedString(attributedString)
var ascent: CGFloat = 0
var descent: CGFloat = 0
var leading: CGFloat = 0
let width = CTLineGetTypographicBounds(line, &ascent, &descent, &leading)
return CGFloat(width)
}

func getRange(of word: String) -> NSRange {
return (self as NSString).range(of: word, options: .widthInsensitive)
}