[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mythtv-dev
Subject:    Re: [mythtv] mytharchive: Font scaling weirdness
From:       "Russell Mora" <rd.mora () gmail ! com>
Date:       2007-06-29 4:50:50
Message-ID: 5545573e0706282150g57dc9e79u413b02e159b17d44 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@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
>
>

[Attachment #5 (text/html)]

Please ignore the below, there is nothing wrong with PIL - the FreeSans.ttf font from \
<a href="http://svn.mythtv.org/trac/changeset/13588">http://svn.mythtv.org/trac/changeset/13588</a> \
just no longer plays nice with mytharchive - I reverted the font and now things work \
fine.&nbsp; It&#39;s late now so I&#39;ll write a ticket tomorrow... \
<br><br><div><span class="gmail_quote">On 6/29/07, <b \
class="gmail_sendername">Russell Mora</b> &lt;<a \
href="mailto:rd.mora@gmail.com">rd.mora@gmail.com</a>&gt; wrote:</span><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> Hi All,<br><br>I&#39;m experiencing some font scaling \
problems with mytharhive that I&#39;ve not been able to find any information \
on.&nbsp; 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: <br><br>Index: \
mytharchive/mythburn/scripts/mythburn.py<br>===================================================================<br>--- \
mytharchive/mythburn/scripts/mythburn.py&nbsp;&nbsp;&nbsp; (revision 13754)<br>+++ \
mytharchive/mythburn/scripts/mythburn.py&nbsp;&nbsp;&nbsp; (working copy) <br>@@ \
-819,6 +819,7 @@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fontsize = \
getScaledAttribute(nodefont, \
&quot;size&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
themeFonts[fontnumber]=ImageFont.truetype(getFontPathName(fontname),fontsize \
)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write( &quot;Loading font %s, \
%s size %s&quot; % (fontnumber,getFontPathName(fontname),fontsize) ) \
<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write( &quot;Font actual size (for \
\&quot;Test\&quot;) is %s by %s&quot; % \
themeFonts[fontnumber].getsize(&quot;Test&quot;) \
)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fontnumber+=1<br><br>&nbsp;def \
getFileInformation(file, folder):<br><br>Results in this in the output log: \
<br><br>Loading font 0, /usr/local/share/mythtv/FreeSans.ttf size 19<br>Font actual \
size (for &quot;Test&quot;) is 38 by 36<br>Loading font 1, \
/usr/local/share/mythtv/FreeSans.ttf size 15<br>Font actual size (for \
&quot;Test&quot;) is 29 by 28 <br>Loading font 2, \
/usr/local/share/mythtv/FreeSans.ttf size 14<br>Font actual size (for \
&quot;Test&quot;) is 28 by 26<br><br>As you can see the height of the rendered text \
is just under twice (~1.875) of what (I would have) expected.&nbsp; 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.&nbsp; Unfortunately \
this includes all of the menu buttons,  i.e. titles, chapter times, etc, which makes \
the DVD image almost unplayable.&nbsp; This happens on all of the DVD \
themes.<br><br>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 &quot;rendered&quot; area.&nbsp; Thus the end results is \
that the layout does not look right...<br><br>I&#39;ve searched for any information \
about this wrt PIL and the freetype library but could not find anything.&nbsp; This \
only started happening after a system upgrade so I tried downgrading freetype and \
PIL, but no luck.&nbsp; If anyone has any insight into this problem (I know next to \
nothing about python) I would appreciate it.&nbsp; Otherwise I think I&#39;ll have to \
start debugging the python imaging library (sounds like fun :-( ). \
<br><br>Cheers,<br>Russell.<br><br>Some system details:<br>2.6.20-gentoo-r8 \
x86_64<br>MythTV - SVN Revision: \
13754<br>media-libs/freetype-2.3.4-r2<br>dev-lang/python-2.4.4-r4<br>dev-python/imaging-1.1.5<br><br>
 </blockquote></div><br>



_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic