mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-05 19:30:30 +08:00
16 lines
1.1 KiB
Go
16 lines
1.1 KiB
Go
//
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// This is a commercial product and requires a license to operate.
|
|
// A trial license can be obtained at https://unidoc.io
|
|
//
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
//
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
package textshaping ;import (_f "github.com/unidoc/garabic";_b "golang.org/x/text/unicode/bidi";_c "strings";);
|
|
|
|
// ArabicShape returns shaped arabic glyphs string.
|
|
func ArabicShape (text string )(string ,error ){_fg :=_b .Paragraph {};_fg .SetString (text );_d ,_a :=_fg .Order ();if _a !=nil {return "",_a ;};for _ae :=0;_ae < _d .NumRuns ();_ae ++{_fb :=_d .Run (_ae );_e :=_fb .String ();if _fb .Direction ()==_b .RightToLeft {var (_de =_f .Shape (_e );
|
|
_aa =[]rune (_de );_dd =make ([]rune ,len (_aa )););_ea :=0;for _cc :=len (_aa )-1;_cc >=0;_cc --{_dd [_ea ]=_aa [_cc ];_ea ++;};_e =string (_dd );text =_c .Replace (text ,_c .TrimSpace (_fb .String ()),_e ,1);};};return text ,nil ;}; |