• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Coercing ligatures to expanded characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coercing ligatures to expanded characters


  • Subject: Re: Coercing ligatures to expanded characters
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 16 Jan 2017 16:46:11 +0100

I tried to make a synthesis of the proposals.

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

on removeLigaturesFromString(inputStringWithLigatures)
set theString to current application's NSString's stringWithString:inputStringWithLigatures
# Convert what may be done applying transform "ÆæffffifflfiflŒœᵫ" & "LJLjNJNjnjDZDzdzIJij"
set inputStringWithLigatures to (theString's stringByApplyingTransform:"Latin-ASCII" |reverse|:false) as text
# Treat the remaining ligatures
set searchStrings to {"Ꜳ", "ꜳ", "Ꜵ", "ꜵ", "Ꜷ", "ꜷ", "Ꜹ", "ꜹ", "Ꜻ", "ꜻ", "Ꜽ", "ꜽ", "Ꝏ", "Ꜩ", "ꜩ", "Ꝡ", "ꝡ"} -- if you find others, add them here
set replaceStrings to {"AA", "aa", "AO", "ao", "AU", "au", "AV", "av", "AV", "av", "AY", "ay", "OO", "TZ", "tz", "VY", "vy"} -- if you find others, add them here
set saveTID to AppleScript's text item delimiters
considering case
set i to 0
repeat with lig in searchStrings
set i to i + 1
set AppleScript's text item delimiters to {lig}
set inputStringWithLigatures to text items of inputStringWithLigatures
set AppleScript's text item delimiters to {item i of replaceStrings}
set inputStringWithLigatures to inputStringWithLigatures as text
end repeat
end considering
set AppleScript's text item delimiters to saveTID


return inputStringWithLigatures
end removeLigaturesFromString

set inputStringWithLigatures to "ꜲꜳÆæꜴꜵꜶꜷꜸꜹꜺꜻꜼꜽffffifflfiflŒœꝎstꜨꜩᵫꝠꝡ" & "LJLjNJNjnjDZDzdzIJij"
my removeLigaturesFromString(inputStringWithLigatures)



Yvan KOENIG running Sierra 10.12.2 in French (VALLAURIS, France) lundi 16 janvier 2017 16:32:03





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Coercing ligatures to expanded characters (From: "Jacob M. Small" <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: "Jacob M. Small" <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Jacob Small <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Denis Boyd <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Jacob Small <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Shane Stanley <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Takaaki Naganoya <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Shane Stanley <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: "Jacob M. Small" <email@hidden>)

  • Prev by Date: RE: AppleScript-Users Digest, Vol 14, Issue 49
  • Next by Date: How to control a Launchdaemon
  • Previous by thread: Re: Coercing ligatures to expanded characters
  • Next by thread: Re: Coercing ligatures to expanded characters
  • Index(es):
    • Date
    • Thread