Bug 339 - [Chameleon] Button font path absolute in Shared Resource
: [Chameleon] Button font path absolute in Shared Resource
Status: CLOSED FIXED
: Chameleon
Core
: 1.1
: PC Windows NT
: P2 normal
: 1.99 beta 3
Assigned To:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2004-04-01 15:04 by
Modified: 2004-11-02 13:51 (History)


Attachments
absolute path to font sharedresource parameter (19.43 KB, text/plain)
2004-10-25 14:42, Chris Thorne
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2004-04-01 15:04:01
Windows 2000
PHP 4.3.3

In order to get the font to be recognized for an application the font path in
the button Shared Resource had to be an absolute path.  Not sure if it's
supposed to support relative paths ... it was presumed to be supported as other
paths in the Shared Resource were relative.
------- Comment #1 From 2004-04-05 15:25:35 -------
this was caused by a problem related to bug 336 and does actually work
correctly.
------- Comment #2 From 2004-06-23 22:00:06 -------
The paths to fonts is definately not an absolute paths, found in the sample
applications.

for example;
Button Shared Resource tag: 
  <labelfont value="fonts/Vera.ttf"/>

The path is actually point to here:
\ms4w\apps\chameleon\htdocs\skins\default\fonts\

Where the html sample templates are here:
\ms4w\apps\chameleon\sample\htdocs\

Paul this seems kind off over complicated, is this true?
------- Comment #3 From 2004-06-24 22:17:38 -------
Chris, I believe this is the new "skinable" way of declaring a font path.  The
"fonts" keyword actually gets replaced on the fly by the current skin directory.

Paul can confirm if this is true or not.
------- Comment #4 From 2004-06-30 16:14:29 -------
I need a methodology to test that this bug is fixed.

I modified a font path in a sharedresource of a sample application and the font
was found.
------- Comment #5 From 2004-07-05 17:13:57 -------
it should support absolute paths (thus ignoring skins) and relative paths as per
skinning logic.  Per skinning logic, every registered skin will be searched in
order from the last one registered to the first one registered, then the default
skin provided with chameleon.

To test, you can try with both absolute path and relative paths in a template,
with caching turned off in the textbutton shared resource to make sure that it
works properly I guess.
------- Comment #6 From 2004-07-06 13:18:59 -------
Absolute path is working well.

Default skins is found as well.

But when I move the skins/default/fonts to skins/sample directory and remove the
"$oApp->registerSkin( 'skins/sample' );" line in the sample application
(.phtml), font are found anyway.

Also when I move the skins/default/fonts to skins/sample2 directory (I created
this directory) and add "$oApp->registerSkin( 'skins/sample2' );" line, font is
not found.
------- Comment #7 From 2004-07-06 14:08:20 -------
I used the "sample_enhanced.phtml".
------- Comment #8 From 2004-07-14 13:28:38 -------
Norm should this bug be reopened? or are you waiting for paul to check it out
first?
------- Comment #9 From 2004-07-14 13:40:09 -------
Chris you are right.  We should reopen this bug.
------- Comment #10 From 2004-07-22 15:27:24 -------
Changed target to 1.99 Beta 3.
------- Comment #11 From 2004-10-05 21:40:24 -------
a note on this.  The font may be found in the case of invalid skins because the
buttonizer will attempt one last desperate guess at a font that should always be
included ... I should review this to see if I should actually include this font
with the buttonizer or if I could possibly use one of the built-in fixed-size
fonts for this purpose ... the idea being that if anything goes wrong we can
work around it.

The issue of the font not being found in a skin directory will have to be
researched ... tomorrow :)
------- Comment #12 From 2004-10-07 08:46:36 -------
added Vera.ttf to buttonizer to be used in case requested font not found.  An
error message will still be emitted to the ErrorManager if installed/used in the
associated chameleon template.

I verified that the label font is located using the same process as all other
button elements.  I then checked to see the progression of fallback from local
skins, default skin, and finally buttonizer default and it seems to work fine.

I think the confusion here is that the buttonizer does try to make some guesses
along the way and if you have the font anywhere it might look it will find it.

If testing this again, use a font other than Vera.ttf to test since buttonizer
will now use Vera.ttf as a last resort.
------- Comment #13 From 2004-10-25 13:27:57 -------
Change font sharedresource paths to a different fonttype in a different
directory and defined an adsolute path to it for the three different shared
resources for:
http://localhost/chameleon/samples/sample_enhanced.phtml

The font is changed for every button using these shared resources except for the
TAB shared resource on the Link Widget Tabs.

I cheaked to see if the Styleresource is even being registered for the Link
widgets and I was able to change the Tab height, but not the font type.

If this is a separate bug let me know so that we can close this one. :)
------- Comment #14 From 2004-10-25 13:52:21 -------
Chris, please attach your template to this bug.
------- Comment #15 From 2004-10-25 14:42:26 -------
Created an attachment (id=53) [details]
absolute path to font sharedresource parameter

Paul here is the template I was working on with my changes.
------- Comment #16 From 2004-10-27 08:45:51 -------
invalid, this works.  A couple of comments:

1. the tabs don't use the font, the labels are actually part of the graphic on
the tabs.

2. the font path is really:

D:\ms4w\apps\chameleon\htdocs\skins\default\fonts\VeraSeBd.ttf

instead of

D:\ms4w\apps\chameleon\htdocs\skins\default\VeraSeBd.ttf

3. the error reporting sucks because the return value is false, and this is used
as the font file, so when the error is reported there is no path listed (and
there should be).  I've fixed this ... you can now change to an invalid font and
it will give you a better warning ...

As a side note, I cleaned up chameleon's findFile function:

* added test for absolute paths before beginning searches
* added clearstatcache() before file_exists() as per php documentation

these changes are not required to get this to work.
------- Comment #17 From 2004-10-27 08:55:32 -------
ha, confirmed that the tab are whole graphics. 

setting the bug to verified. 
------- Comment #18 From 2004-10-28 11:08:11 -------
Verified on Fedora Core 2.  Nice works.  Question:  Is it possible to add the
name of the font not found in the error message?  It may help debugging template
where you could have a large number of fonts.
------- Comment #19 From 2004-10-28 12:34:42 -------
see comment #16: 

"3. the error reporting sucks because the return value is false, and this is used
as the font file, so when the error is reported there is no path listed (and
there should be).  I've fixed this ... you can now change to an invalid font and
it will give you a better warning ..."

The error report should now read something like:

"ERROR: Button.php was unable to find the font 'fonts/VeraBlah.ttf' in any of
the registered or default skins."
------- Comment #20 From 2004-10-28 12:48:29 -------
I read comment #16 before but didn't check dates.  Heech!
------- Comment #21 From 2004-11-01 15:55:58 -------
verified on windows beta 3 20041101

setting to closed
------- Comment #22 From 2004-11-02 13:51:30 -------
I checked comment #19 and it works on Fedora Core 2.