Styles - font question

Hello! I’m new to SAB. I’m supporting a project that unfortunately needs to use non-unicode characters. These are sparse in the text, but important.

The non-unicode characters are written using a different font, with glyphs mapped to letters like “f, p, x” i.e. U+0066, U+0070, U+0078

All of the rest of the text in the app uses Perso-Arabic script, so there’s no overlap of Unicode code points.

Question: Is there any way to use SAB to apply a certain font only to a particular Unicode code point (or range)? I know this is possible in CSS, but I haven’t had much luck in the Styles of SAB.

Note, I have been able to (beautifully) get this to work in the main text of the app by using the USFM operator \sig…\sig* and setting that style to the right font, but the problem arises in other parts of the interface, such as when I do a search and see the Search Results Context.

I found the style sheet for Search Results Context (though I don’t understand the difference between the Text Styles tab and the User Interface Styles tabs when a style has the same name), but I think I need to tell it to use one font for certain Unicode code points and another font for everything else.

I tried to use a custom style for this too, but I couldn’t figure out where and how SAB would apply suchhl custom styles.

Thank you so much for reading and for your help!

I have seen a similar problem with the \sig...\sig* working in the text but not in the interface.

I had not heard of CSS being able to do this. I have done a test and had a partial success.

image

But it is only on the Menu page and is not in the body text and does not show up again if you come back to the menu. But only tested on Nox player so far. There is some hope.

Using this page for reference: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range
I was able to get it to work by editing the .appdef file and making a lot of changes additions of font-family: U+75-79. This file is in XML. Make a backup before you do this in case you make a mistake. If you don’t understand XML syntax it may be pretty scary.
Before you edit the .appdef file, Add the font you want to have for the different font. Save and close SAB.

Go to the Fonts section.
Look for the font you just added.
Mine looked like this:

    <font family="AB">
      <font-name>Archivo Black</font-name>
      <display-name>Archivo Black</display-name>
      <filename format="truetype">ArchivoBlack-Regular.ttf</filename>
      <style-decl property="font-weight" value="normal"/>
      <style-decl property="font-style" value="normal"/>
    </font>

All I did was to add a line:

<style-decl property="unicode-range" value="U+75-79"/>

before the </font> line.
That adds the characters uvwxy to the Unicode range for that font.

Then I had to do a few adjustments in SAB in the Styles section.
In Body I change:
font-family: font1; to font-family: AB, font1;
Note that AB, had to go first.
In body.single I did a similar thing. In fact anywhere the font-family occurred I modified it. I also added font-family to a number of specific styles. The UI styles were never successful.

So on entry the sub head in the Contents menu had a different font for w. But it was only there on first opening. It was not there when going back to the menu.
In the body all 5 letters showed in the different font. That was after the body.single had the font-family added.
The div.mt showed the different font.
If the font1 does not have the same characters it may work better in more situations.

I’m wondering if you should reconsider having non-Unicode characters… What are the characters that they represent? Some special symbols in a hacked font, I would guess.

The characters are Arabic ligature isolated forms for salutory phrases said after the name of God or a prophet, etc. Unicode currently has about 2 of these: ﷺ (U+FDFA) and ﷻ (U+FDFB), but there are quite a few more. Our text uses three - the FDFB one, and two others that are not in Unicode.

There are maybe 15ish that would be good to have in Unicode. I have seen a Unicode proposal for this, which I was going to link here, but apparently the Unicode site has had a catastrophic failure. (I was going to include that URL, but apparently new posters aren’t allowed to include URLs)

Here is that URL to the Unicode proposal for these honorifics:
http://www.unicode.org/L2/L2019/19289r-arabic-honorifics.pdf

Also, Jeff, I saw in another post that you had been using the “Khorasa honorifics.ttf” font. How can I get that font? I searched for it but couldn’t find it. Thanks!

I don’t see any way to attach files to this post, so I’ll give you links to Dropbox files (but no guarantee that the files will be there forever…)
Here is the link to the font:


and here is the link to the instructions how to use the characters (note that there is a very specific procedure to get the characters to show up, including setting BOTH the Latin and Complex text fonts):

Note that the special characters with the honorifics in this font are at U+E00x, i.e. in the Private Use Area (PUA). That means that this is a valid Unicode font, unlike one that would take over the other characters (like “f”) and “misuse” them for other purposes - what we call a hacked Unicode font. Hope that helps.

Thank you all so much for your help on this project. I just wanted to follow up to tell what I ended up doing.

Although using the various styles to switch back and forth between fonts (one font for the body text and a different font for the honorifics) worked well in the main body text, it didn’t work well in the interface, when using the search function, or when displaying book names in the top navigation.

What I ended up doing was creating a new font (using the opensource FontForge program), where I added the honorifics from the honorifics font to the main script font. Since the app no longer has to switch back and forth between fonts, everything tends to display correctly. There still are a few kinks to do with text direction that need to be worked out, but everything is mostly solved.

Thanks again everyone! I’ll start a new thread if I run in to some other, different problem.