[mythtv] mytharchive: Font scaling weirdness

Russell Mora rd.mora at gmail.com
Fri Jun 29 04:50:50 UTC 2007


Please ignore the below, there is nothing wrong with PIL - the
FreeSans.ttffont from
http://svn.mythtv.org/trac/changeset/13588 just no longer plays nice with
mytharchive - I reverted the font and now things work fine.  It's late now
so I'll write a ticket tomorrow...

On 6/29/07, Russell Mora <rd.mora at gmail.com> wrote:
>
> Hi All,
>
> I'm experiencing some font scaling problems with mytharhive that I've not
> been able to find any information on.  Basically the python imaging library
> (PIL) is reporting rendered font sizes much bigger than what they actually
> are - this extra debug statement illustrates the problem:
>
> Index: mytharchive/mythburn/scripts/mythburn.py
> ===================================================================
> --- mytharchive/mythburn/scripts/mythburn.py    (revision 13754)
> +++ mytharchive/mythburn/scripts/mythburn.py    (working copy)
> @@ -819,6 +819,7 @@
>          fontsize = getScaledAttribute(nodefont, "size")
>          themeFonts[fontnumber]=ImageFont.truetype(getFontPathName(fontname),fontsize
> )
>          write( "Loading font %s, %s size %s" %
> (fontnumber,getFontPathName(fontname),fontsize) )
> +        write( "Font actual size (for \"Test\") is %s by %s" %
> themeFonts[fontnumber].getsize("Test") )
>          fontnumber+=1
>
>  def getFileInformation(file, folder):
>
> Results in this in the output log:
>
> Loading font 0, /usr/local/share/mythtv/FreeSans.ttf size 19
> Font actual size (for "Test") is 38 by 36
> Loading font 1, /usr/local/share/mythtv/FreeSans.ttf size 15
> Font actual size (for "Test") is 29 by 28
> Loading font 2, /usr/local/share/mythtv/FreeSans.ttf size 14
> Font actual size (for "Test") is 28 by 26
>
> As you can see the height of the rendered text is just under twice
> (~1.875) of what (I would have) expected.  The end result of this is that
> when mythburn tries to render some text it decides it is too big to fit into
> the allowed area and truncates it - down to zero characters.  Unfortunately
> this includes all of the menu buttons, i.e. titles, chapter times, etc,
> which makes the DVD image almost unplayable.  This happens on all of the DVD
> themes.
>
> To see what size the rendered text would be I hacked mythburn not to
> truncate the text (by hard-coding the returned height from intelliDraw to be
> the same as the requested size from when the font is loaded) - surprisingly
> enough the rendered text looks about the right size, however it does look
> like it has been rendered into a area about the size reported, i.e. ~1.875
> the normal size, and aligned to the bottom of the "rendered" area.  Thus the
> end results is that the layout does not look right...
>
> I've searched for any information about this wrt PIL and the freetype
> library but could not find anything.  This only started happening after a
> system upgrade so I tried downgrading freetype and PIL, but no luck.  If
> anyone has any insight into this problem (I know next to nothing about
> python) I would appreciate it.  Otherwise I think I'll have to start
> debugging the python imaging library (sounds like fun :-( ).
>
> Cheers,
> Russell.
>
> Some system details:
> 2.6.20-gentoo-r8 x86_64
> MythTV - SVN Revision: 13754
> media-libs/freetype-2.3.4-r2
> dev-lang/python-2.4.4-r4
> dev-python/imaging-1.1.5
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-dev/attachments/20070629/2d077c3a/attachment.htm 


More information about the mythtv-dev mailing list