#!/usr/bin/env python # coding: utf-8 # # Final characters # # Some final characters have an effect on spacing. # In[1]: get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') # In[2]: from fusus.lakhnawi import Lakhnawi from fusus.lib import dh # In[3]: Lw = Lakhnawi() Lw.setStyle() # In[4]: Lw.getPages(None) # Here are all finals that introduce a space if there is no space. # The space will be inserted just before the next non-diacritic. # In[5]: Lw.showFinals() # # Page 150 # ## Final, causing a space # # Observe line 1, char **45**: there is a final qaf, but no physical space. # This is where a final form triggers a space although, since it is the end of a line, not a very useful one. # Note, however, that the space is inserted after the diacritics that follow the qaf. # In[6]: Lw.showLines(150, search="\ufed6", orig=True) # We show this line in HTML, with spaces marked (this is based on the extracted text) # In[7]: Lw.htmlPages(150, line=1, showSpaces=True) # And this is the original of the same line. # In[8]: Lw.drawPages(150, clip=(80, 110)) # ## Final, causing space, with existing space # # Observe the space in line 2, char **39**, where there was already a detected space by of width 3.4pt on # the basis of the bounding boxes. # In[9]: Lw.showLines(150, search="\ufe94", orig=True) # ## Final, not causing a space # # Observe that the alef `wasla` in line 2, char **104** does not introduce a space, since it is not in # the list of characters that can do that. # In[10]: Lw.showLines(150, search="\ufb51", orig=True) # We show this line in HTML, with spaces marked (this is based on the extracted text) # In[11]: Lw.htmlPages(150, line=2, showSpaces=True) # And this is the original of the same line. # In[12]: Lw.drawPages(150, clip=(110, 140)) # In[ ]: