// // 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 (_ed "github.com/unidoc/garabic";_ae "golang.org/x/text/unicode/bidi";_a "strings";); // ArabicShape returns shaped arabic glyphs string. func ArabicShape (text string )(string ,error ){_eg :=_ae .Paragraph {};_eg .SetString (text );_ee ,_d :=_eg .Order ();if _d !=nil {return "",_d ;};for _ec :=0;_ec < _ee .NumRuns ();_ec ++{_ea :=_ee .Run (_ec );_c :=_ea .String ();if _ea .Direction ()==_ae .RightToLeft {var (_ac =_ed .Shape (_c ); _g =[]rune (_ac );_acb =make ([]rune ,len (_g )););_gd :=0;for _ga :=len (_g )-1;_ga >=0;_ga --{_acb [_gd ]=_g [_ga ];_gd ++;};_c =string (_acb );text =_a .Replace (text ,_a .TrimSpace (_ea .String ()),_c ,1);};};return text ,nil ;};