PiRSquared17 / bpbible

Automatically exported from code.google.com/p/bpbible
Other
0 stars 1 forks source link

Selecting Hindi language causes font to display too small in verse tree, titles etc #142

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Select File/Language/Bible Book Names/Hindi
2.
3.

What is the expected output? What do you see instead?

When changing language to other languages the interface text remains at 
about an 8 size.  When selecting Hindi, the text gets reduced to 6 or less.

What version of the product are you using? On what operating system?
0.4.5 on Windows 7 and Win XP

If the problem happens with one particular module (Bible, commentary,
dictionary, or book), what module is it?
Happens on all modules.

Please provide any additional information below.

Selecting "Use this font in the user interface" from the font selection 
page does not have any affect.  
The text in the frames respond to the changes in font and size coming from 
the select font dialog.  

Just the user interface items are too small(ie 
Bible frame: book/chaper names
Other Books frame: Title, combobox-tree names
Dictionary: Title
Commentary: title and verse selector
I guess anything other than the module text that is displayed in Hindi is 
very small(almost too small to read).

You may need to install East Asian language support to be able to display a 
unicode devanagari font.  The default font for devanagari(Hindi) is Mangal.  
I use Arial Unicode MS but neither of these fonts will display large enough 
to read easily.  

Adding the line below to the draw routine in the header_bar.py module makes 
the book names appear at a good readable size.  but I'm unable to figure 
out where to make changes to fix the other window components.

self.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial 
Unicode MS'))

I can send screen shots if that would help.

Thanks for a great product

Original issue reported on code.google.com by timjch...@gmail.com on 5 Apr 2010 at 4:53

GoogleCodeExporter commented 9 years ago
Just a further update.  I have been able to add the following line of code to 
the 
following 5 modules that fixes all affected small text.  Adding:

self.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Arial 
Unicode MS'))

to:
treecombo.py
auilayer.py
header_bar.py
genbooktree.py
versetree.py

makes the program work well with Hindi or Nepali text.  I'm trying to come up 
with a 
better solution as I understand the code better so that I'm not hard coding 
these 
into the code.

Original comment by timjch...@gmail.com on 6 Apr 2010 at 2:14

GoogleCodeExporter commented 9 years ago
As an update, I discovered this problem looks to be a Windows 7 issue. I'm not 
seeing 
it happen like I reported above on Xp.  I installed the current svn on a vmware 
XP 
session and found that the text related to this problem displays correctly.  
Running 
both from the current svn or the new 0.4.6 code on Windows 7 causes the text to 
display 
small.  See attached screen shots of Win 7 and Win Xp. I'll continue to try to 
locate 
the root of the problem.  Thanks

Original comment by timjch...@gmail.com on 26 May 2010 at 2:48

Attachments:

GoogleCodeExporter commented 9 years ago
I installed BpBible to a friends computer.  On XP under the Control Panel> 
Regional and 
Language Options> Languages> Supplemental language support> Install files for 
complex 
script and right-to left languages check box, he did not have this option 
selected.  
The interesting thing is that the identical components were affected that I'm 
having 
issues with under Win 7.  In this new case all the same fields show up as boxes 
while 
the rest of the program displays fine. See attached picture.
Selecting this language option takes care of the problem on XP but I've yet to 
figure 
out why the fonts show up small on Win 7. 

Original comment by timjch...@gmail.com on 29 May 2010 at 8:22

Attachments:

GoogleCodeExporter commented 9 years ago
I've seen it on Server 2008 R2 on the classic theme, and I think also possibly 
on XP
with classic theme. I'm not sure what to do; some places we can't really fix 
(e.g. 
title bar of window). Others are possible not really easily fixable (like the
captions of each pane). Others can be fixed by merely increasing the font size, 
but
if it is sometimes working on XP and sometimes not, this may be 
unsatisfactory.,.

Original comment by benpmor...@gmail.com on 29 May 2010 at 12:21

GoogleCodeExporter commented 9 years ago
I came up with a fix for Win 7.  I'll need to test on XP but I think it should 
work.  
This fix takes care of the lions share of the small text. Only the title bar 
items 
have small text now.  Part of the problem is that several of these IUs default 
to "MS 
Shell Dlg 2" which is not being set in the font selector. Setting these to 
Arial also 
didn't fix it.  Changing the font default to Arial Unicode MS makes both 
English and 
devanagari work.  I found that the UI for these items is being set up before 
any font 
modules were being called.   So here is what I did.  I set the default font to 
Arial 
Unicode MS in the fonts.py

def _default_font():
    if osutils.is_msw():
        # MSW has MS Shell Dlg 2, which can't be set to.
        # just use arial 12 pt
        return "Arial Unicode MS", 12, False
        #return "Arial", 12, False

Then I set the font for the UI areas in the mainframe.py before the setup of 
the UI 
toolbars etc.  

self.load_data()
self.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False, 
\fonts.default_fonts()[1][0]))
self.make_toolbars()

Presumably, if you were to accept this fix, you would also need to distribute 
and 
install Arial Unicode MS in your setup program.

Attached are the two modules with the changes.

Original comment by timjch...@gmail.com on 30 May 2010 at 2:57

Attachments:

GoogleCodeExporter commented 9 years ago
Here is the new screenshot.  The circles are over those items that are still 
coming up 
small.

Original comment by timjch...@gmail.com on 30 May 2010 at 3:00

Attachments:

GoogleCodeExporter commented 9 years ago
I can't reproduce the same resizing effect with mainframe.py and fonts.py which 
you
gave - it doesn't change anything for me (windows server 2008 R2). 
Was there another change you had?

By the way, Arial Unicode MS is a default windows font, I believe, and so 
wouldn't
need distributing.

Original comment by benpmor...@gmail.com on 31 May 2010 at 2:44

GoogleCodeExporter commented 9 years ago
Ok, I had the same result as you when I tried to test again.  I discovered that 
if 
the default font is still Arial in the data.conf file, you won't see a change 
in the 
UI.  So I went into the File/Set Fonts dialog and set the default font to Arial 
Unicode MS and checked the use default font check box.  Then I restarted 
BPBible.  
Now I see a change with the code changes like I noted above.  Attached is a set 
of 
test cases with and without the program changes for both XP and Win7 using 
Bible book 
names of Nepali and English to see if any big changes happen if this change is 
made.  
The test cases show for XP that changing to Arial Unicode MS has only slight 
changes, 
Win7 has a big difference when Nepali or Hindi is selected for Bible book names.
It could be that you are not seeing a difference because you are on Win server 
2008 
which might be acting more like XP in the tests, or you may still have Arial 
selected 
in the font dialog.  In any case, I think this problem is limited to Win7 so 
you'll 
need to find a Win7 box to test.

Original comment by timjch...@gmail.com on 31 May 2010 at 6:01

Attachments:

GoogleCodeExporter commented 9 years ago
I've found what the problem is why I'm not seeing the larger hindi size - I 
didn't
have Arial Unicode MS. Looks like it comes with Office, and isn't 
redistributable.
Installing it on my windows machine did show the fix worked.
Windows Server 2008 R2 is approximately a server version of Windows 7, by the 
way.

I really don't know what's best to do here. Making Arial Unicode MS the default 
font
has drawbacks as well; we can't distribute it, and also I don't like the font 
that
much (that said, I don't know that Arial is the best default either).

Original comment by benpmor...@gmail.com on 31 May 2010 at 6:48

GoogleCodeExporter commented 9 years ago
I didn't realize that about Arial Unicode MS.  So I tried Code2000 and that 
isn't too 
nice either.  Would maybe a conditional work? like something like the 
following?:

if sys.winver == "2.6" AND (locale == "ne" OR locale == "hi"): 
self.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, False, 
fonts.default_fonts()[1][0]))

I'm not sure how you would check for the locale yet, but this would check for 
windows 
7 and if we are using a devanagari language.  Then it would bump the affected 
UI 
areas up to font 11 using Arial.

It appears like there is not one nice place to put code like this since it will 
affect the font size of other small windows like "books"

Original comment by timjch...@gmail.com on 31 May 2010 at 10:38

GoogleCodeExporter commented 9 years ago
OK, that's what I've put in more or less in r1020.
I think this is probably best; although it may lead to english text being 
larger than
it should be, if it is set up for use with nepali/hindi, it's best for that to  
work
correctly. A possibility to slightly reduce the hackiness of the current 
hardcoded
approach is to put it in the locale config, but I won't do that at the moment.

This needs testing on Vista - Jon, can you do that? Quite possibly the 
is_windows7
needs to be is_vista_or_7

Thanks for chasing this through Tim.

Original comment by benpmor...@gmail.com on 31 May 2010 at 10:12

GoogleCodeExporter commented 9 years ago
Looks fine to me on Vista (though I'm not entirely sure what size it should 
look).

Original comment by jonmmor...@gmail.com on 26 Jun 2010 at 11:18

GoogleCodeExporter commented 9 years ago
I did some more testing on Win 7 and found that the code change in mainframe.py 
caused some overlapping on the toolbar and some of the other widgets were 
showing larger text than was desired.  So I moved that bit of code after the 
toolbar setup in mainframe.py.  That caused several other gui items to now 
display small, so I went after each of those individually.  I've attached some 
changes to a few modules for your review.  Incorporating these will only affect 
Win 7 and Hindi and Nepali locales per your if statement.

Basically the following code was added to treecombo.py auilayer.py and 
versetree.py:

if osutils.is_win7() and pysw.locale_lang in ('ne', 'hi'):
    self.tree.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, fonts.default_fonts()[1][0]))

Thanks

Original comment by timjch...@gmail.com on 30 Jun 2010 at 5:30