This repository was archived by the owner on Mar 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Appy rtl #41
Open
hmmftg
wants to merge
8
commits into
go-pdf:main
Choose a base branch
from
hmmftg:appy-rtl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Appy rtl #41
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a455c92
fix rtl presentation form
hmmftg f8ccbe0
support rtl just arabic for now
hmmftg bc56edf
fix rtl sample, add rtl fonts
hmmftg bfc3a7b
add test reference and fix test issue
hmmftg d7b221f
merge cleanup
hmmftg ad09bbd
remove unlicenced font and fix automatic rtl
hmmftg dd6b32d
enhance rtl
hmmftg 72c8f10
Enhance RTL
hmmftg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ doc/body.md | |
| doc/index.html | ||
| doc/index.html.ok | ||
| coverage.html | ||
| .vscode | ||
|
|
||
| # macOS | ||
| .DS_Store | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * Copyright (c) 2013-2014 Kurt Jung (Gmail: kurt.w.jung) | ||
| * | ||
| * Permission to use, copy, modify, and distribute this software for any | ||
| * purpose with or without fee is hereby granted, provided that the above | ||
| * copyright notice and this permission notice appear in all copies. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| */ | ||
| package fpdf | ||
|
hmmftg marked this conversation as resolved.
|
||
|
|
||
| var registeredIsRtl func(string) bool = nil | ||
|
|
||
| func RegisterIsRtl(method func(string) bool) { | ||
| registeredIsRtl = method | ||
| } | ||
|
|
||
| // IsRtl checks if the text has rtl direction | ||
| func isRTL(text string) bool { | ||
| if registeredIsRtl != nil { | ||
| return registeredIsRtl(text) | ||
| } | ||
| if len(text) == 0 { | ||
| return false | ||
| } | ||
| r := []rune(text) | ||
| //Ranges are taken from : https://stackoverflow.com/questions/12006095/javascript-how-to-check-if-character-is-rtl | ||
| if r[0] >= 0x0591 && 0x07FF >= r[0] { | ||
| return true | ||
| } | ||
| if r[0] >= 0xFB1D && 0xFDFD >= r[0] { | ||
| return true | ||
| } | ||
| if r[0] >= 0xFE70 && 0xFEFC >= r[0] { | ||
| return true | ||
| } | ||
| if r[0] == 0x200F || r[0] == 0x202B || r[0] == 0x202E { | ||
| return true | ||
| } | ||
| return false | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| فارسی با انگلیسی: | ||
| سلام abcdefghijklmnopqrstuvwwxyz خوبی xml چرا swf | ||
|
|
||
| العربی: | ||
| أكل بعض أكثر من هذه الكعك الفرنسي لينة وشرب بعض الشاي. | ||
|
|
||
| فارسی: | ||
| مقداری دیگر از این نان های نرم فرانسوی بخورید و کمی چای بنوشید. | ||
|
|
||
| فارسی با اعداد: | ||
| سلام ۱۲۳ خوبی ۲۴۲۳ چرا 123 | ||
|
|
||
| english: | ||
| sample english text همراه arabic لغت inside |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.