Jump to content


Photo

Macro for changing fonts

Unicode hebrew greek SBL fonts

  • Please log in to reply
4 replies to this topic

#1 Tony Pyles

Tony Pyles

    Gold

  • Active Members
  • PipPipPipPip
  • 264 posts
  • Gender:Male
  • Location:Norman, OK
  • Interests:Hebrew, Greek, Psalms, Septuagint, Patristics, Hermeneutics, Linguistics, NT use of the OT, Reformed Dogmatics
  • Accordance Version:11.x
  • Platforms:Mac OS X, Windows, iOS

Posted 14 June 2015 - 10:37 PM

Hi All,

 

I thought I had cracked a way to create a macro in Word using Find/Replace All to change any Unicode Greek and Hebrew to a font of my choosing. It works, but only mostly. I'll paste my steps below. The problem seems to be with characters that use combining diacritics, both in Greek and in Hebrew. E.g., for any Hebrew character with a dagesh, the dagesh doesn't get changed but everything around it does, with the result that a vowel under such a character gets bumped out and given a hollow circle (I'll post a screenshot). Similarly, some (but not all!) Greek letters with breathing marks don't get changed.

 

Any suggestions on how to fix this? It happens both with Hebrew/Greek Unicode pasted from Accordance and with Hebrew/Greek Unicode that I type out. Thanks in advance,

 

Tony

 

Edit: here's that screenshot:

Attached File  Screen Shot 2015-06-15 at 1.40.00 pm.png   19.76KB   1 downloads

 

Fantastic! I’ve cracked a way to ensure all of my Unicode Greek is in a specific font (should work for Hebrew, as well).

 

There are Greek and Greek Extended Unicode ranges, so I need to run two sets of find/replace all.

For the first, paste [Ͱ-Ͽ] into Find, check Use Wildcards, click in the Replace box and then click on Format, changing Font to desired font (e.g., SBLBibLit). Then Replace All!

 

Then do the same with [-] in the Find box.

 

For Hebrew, use [֑-״]

 

FYI the F/RA for Greek will affect some Coptic, but not in the 2C80 to 2CFF range.

 

In order to create a macro for this, follow the above steps with record macro running, then go to the Visual Basic editor. Visual Basic thinks you are trying to replace the Unicode characters with nothing, so the line that has .Replacement.Text = “” needs to be replaced with

         .Replacement.Font.Name = "SBL BibLit"

 

Then it should work!


Edited by Tony Pyles, 14 June 2015 - 10:41 PM.

  • Fabian likes this

#2 Tony Pyles

Tony Pyles

    Gold

  • Active Members
  • PipPipPipPip
  • 264 posts
  • Gender:Male
  • Location:Norman, OK
  • Interests:Hebrew, Greek, Psalms, Septuagint, Patristics, Hermeneutics, Linguistics, NT use of the OT, Reformed Dogmatics
  • Accordance Version:11.x
  • Platforms:Mac OS X, Windows, iOS

Posted 14 June 2015 - 10:54 PM

Well, it looks like for Hebrew I just need to include another part of the Unicode range, from the so-called Alphabetic presentation forms. So if I include [יִ-ﭏ] in addition to what I have above, the hollow circles sort themselves out. That doesn't explain why the Greek isn't fully working.



#3 Tony Pyles

Tony Pyles

    Gold

  • Active Members
  • PipPipPipPip
  • 264 posts
  • Gender:Male
  • Location:Norman, OK
  • Interests:Hebrew, Greek, Psalms, Septuagint, Patristics, Hermeneutics, Linguistics, NT use of the OT, Reformed Dogmatics
  • Accordance Version:11.x
  • Platforms:Mac OS X, Windows, iOS

Posted 16 June 2015 - 05:15 PM

Looks like the Greek works fine if I don't have Track Changes on. That's weird.

 

Anyway, here's the VB code if anyone wants to create and use this macro for themselves:

Sub Fonts()
'
' Fonts Macro
'
'
    Selection.WholeStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.WholeStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[" & ChrW(880) & "-" & ChrW(1023) & "]"
        .Replacement.Font.Name = "SBL BibLit"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[" & ChrW(7936) & "-" & ChrW(8190) & "]"
        .Replacement.Font.Name = "SBL BibLit"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[" & ChrW(1425) & "-" & ChrW(1524) & "]"
        .Replacement.Font.Name = "SBL BibLit"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[" & ChrW(64285) & "-" & ChrW(64335) & "]"
        .Replacement.Font.Name = "SBL BibLit"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Execute
End Sub



#4 Tony Pyles

Tony Pyles

    Gold

  • Active Members
  • PipPipPipPip
  • 264 posts
  • Gender:Male
  • Location:Norman, OK
  • Interests:Hebrew, Greek, Psalms, Septuagint, Patristics, Hermeneutics, Linguistics, NT use of the OT, Reformed Dogmatics
  • Accordance Version:11.x
  • Platforms:Mac OS X, Windows, iOS

Posted 16 June 2015 - 05:18 PM

Maybe it is easier to copy/paste if I put it in as a quote. You can change the font names if you want to use different fonts for Greek and Hebrew.

 

 

Sub Fonts()

'
' Fonts Macro
'
'
    Selection.WholeStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.WholeStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[" & ChrW(880) & "-" & ChrW(1023) & "]"
        .Replacement.Font.Name = "SBL BibLit"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[" & ChrW(7936) & "-" & ChrW(8190) & "]"
        .Replacement.Font.Name = "SBL BibLit"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[" & ChrW(1425) & "-" & ChrW(1524) & "]"
        .Replacement.Font.Name = "SBL BibLit"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[" & ChrW(64285) & "-" & ChrW(64335) & "]"
        .Replacement.Font.Name = "SBL BibLit"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Execute
End Sub
 


#5 Tony Pyles

Tony Pyles

    Gold

  • Active Members
  • PipPipPipPip
  • 264 posts
  • Gender:Male
  • Location:Norman, OK
  • Interests:Hebrew, Greek, Psalms, Septuagint, Patristics, Hermeneutics, Linguistics, NT use of the OT, Reformed Dogmatics
  • Accordance Version:11.x
  • Platforms:Mac OS X, Windows, iOS

Posted 16 June 2015 - 06:53 PM

Here is the process in more detail.







Also tagged with one or more of these keywords: Unicode, hebrew, greek, SBL, fonts

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users