Home » Archived » BIRT » Can't set a font typeface for the Body of a report(Can't set a font typeface for the Body of a report)
Can't set a font typeface for the Body of a report [message #1690068] |
Tue, 24 March 2015 23:06 |
Al Koch Messages: 62 Registered: August 2011 |
Member |
|
|
I have a report (based on a Template that pulls from a Library if that matters) where I need to specify a particular font typeface. Actually, I want to specify a selection list of typefaces but the Designer's Edit facility that allows changes to the default report style only allows selection of a particular typeface and not a list. So, to define a selection list of typefaces I have tried to use a CSS file. In trying to get this to work I have discovered that I can't even specify a single font typeface for the body of a report.
In normal CSS we can define this:
body {
background: yellow;
font-family: Impact, Charcoal, sans-serif;
color: red;
}
Due to the "cascading" aspect of CSS this, of course, results in all text anywhere on a page (even within other page elements) being rendered in the Impact typeface (assuming it's available on the system, if not then Charcoal or sans-serif is used). In BIRT I have done the following to try and replicate this desired behavior:
1) In the report I have deleted the default "report" style that defines a typeface.
2) I have a CSS file that contains:
report-body {
background: yellow;
font-family: Impact, Charcoal, sans-serif;
color: red;
}
3) I have used a "Use CSS" on the Styles in Outline and pointed at the CSS file.
4) On the Master Page I have applied the report-body style. (It appears that I cannot apply any style to the Outline page itself.)
Here's what I get:
1) The "background: yellow" is applied to all pages as expected.
2) The "color: red" is only seen in the Header and Footer of the Master Page and it fails to cascade down into a Text element placed on the Outline page.
3) The "font-family: Impact, Charcoal, sans-serif" is completely ignored everywhere.
From this simple test it appears to me that the CSS feature of BIRT is only working in a limited fashion.
Can someone help me see what I am doing wrong here?
Thank you.
|
|
|
Re: Can't set a font typeface for the Body of a report [message #1690334 is a reply to message #1690068] |
Thu, 26 March 2015 16:12 |
Jesse Freeman Messages: 184 Registered: January 2015 |
Senior Member |
|
|
Could you elaborate on your desired use case with the list of type faces?
Regarding the results you are getting from your CSS change, what I believe is happening is that the portions that are not respecting the change have those properties set at a lower level which is overriding what you have specified for report-body.
Through the BIRT Designer GUI, you can go to the elements that are not taking the changes and inspect the particular setting within the elements Advanced menu in the Property Editor. My guess is each of these elements will already have that property set to a different value.
For more confirmation, you can use your web browsers debugging tools (I prefer Chrome for this) and drill down in the DOM tree to the elements that aren't taking your CSS changes. You should then be able to see which CSS properties are being used for that particular element.
[Updated on: Thu, 26 March 2015 16:13] Report message to a moderator
|
|
|
Re: Can't set a font typeface for the Body of a report [message #1690362 is a reply to message #1690334] |
Thu, 26 March 2015 21:07 |
Al Koch Messages: 62 Registered: August 2011 |
Member |
|
|
Hi Jesse,
Thanks for the response - it gave ma a couple of things to go look at.
Here are some interesting new pieces of information:
1) Use Case: As you know we can't depend on the OS of the User viewing a report to necessarily have a particular font so it is a good practice to specify a list of "similar" fonts so the browser can hopefully locate one. IMO, this is such an important thing to do it would be useful if BIRT was enhanced so that we could do this without having to go to the extra steps involved with using a CSS file.
2) I wasn't looking at the Advanced tab. When I did I saw that the Master Page's Advance font did show the font-family selection list from the CSS file! But if I then clicked on an element in the Header or Footer (which come from a Library) that showed a font of "Verdana: inherited". So I went back to the Library and applied the CSS file's style to the Library and I still got Verdana. Finally I deleted and re-placed the Text element and back in the reprot we suddenly got the font-family on the text element! So then, in the Library, I set that new Text element to Verdana, 18 pt and returned to the report and we were back to "Verdana". It looks like if I apply a style to an element in a Library, use that element in a report and then apply a style to the report's Master Page, it doesn't override the style I applied back in the Library. Is that observation correct and is that how BIRT should operate? I would think that it's useful to allow an override of a style applied in a Library when you are in the report design.
3) Now that I know what I have to do to get "font cascading" to work on the Master Page I see that it does not work at all for elements on the Layout Page. I simply place a text element on the Layout page (with no changes to its style) and its font is not being set to the Master Page's font-family - it is set to "serif". (Note however, that the CSS file's Background color is being applied to the Layout page which seems inconsistent!) I can manually apply a style to the element to get the desired font-family list, but this whole effort has been to try and define a font-family preference list, apply it once and not have to apply a font style to every element used in the report. Standard HTML works this way for fonts if a font style is applied to the <body> element. BIRT does apply a Background style bur shouldn't it also do the same for fonts?
4) In all of the above I noticed that a Library's Outline does not show Styles but only Themes. Why is that the case?
5) To easily see if various changes are being applied I've been using "dramatic" fonts but it appears that BIRT ignores "Wingding" and "Webding". I have confirmed that these (standard Window font families") are on my system and I can use them in, say, a Word document. But if I try to use font-family: "Webdings", sans-serif; or font-family: "Wingdings", sans-serif; i just get a generic sans-serif display. Why won't BIRT display these particular fonts?
In summary, it looks like my 1st problem was caused by the failure of BIRT to override a Style set in the Library. I can fix that but, per #3 above, I still can't set a font style to the Master Page and have it apply to elements on the Layout Page.
I have attached a very simple CSS file and report that show that the Master Page font style is not applied to the text element on the Layout page.
There must be some way to make this work. Can you help me with this more specific problem?
Thanks for your help!
-
Attachment: TestCSS.zip
(Size: 1.24KB, Downloaded 120 times)
[Updated on: Thu, 26 March 2015 21:08] Report message to a moderator
|
|
| | | |
Re: Can't set a font typeface for the Body of a report [message #1691180 is a reply to message #1691041] |
Thu, 02 April 2015 21:18 |
Al Koch Messages: 62 Registered: August 2011 |
Member |
|
|
Hi Jesse,
Thanks for the reply.
#3) I looked in the DOM also and I see what you saw. I changed my CSS to look like:
body .style_0 {
background: yellow;
font-family: Impact, Charcoal, sans-serif;
color: red;
}
I also tried just ".style_0 {" but in both cases, in the Outline tab under the Styles folder under the name of the CSS file (and after a "Reload CSS File) the CSS file's original .report-body disappears (which it should) but nothing replaces it! It's acting like ".style_0" is "reserved" and it refuses to show it or act on it. Do you have any idea why ".style_0" cannot be used in a CSS file?
#5) OK, this was my fault and I apologize. I am using Firefox but didn't realize that it does not support Webdings/Wingdings! Just my luck that I chose those as a font for testing to be able to easily see if the font was being applied!
So, #5 is resolved but I am still in need of a solution to #3.
Just so there is no confusion, all I want to do in BIRT is accomplish what
body { font-family: Impact, Charcoal, sans-serif; }
does in standard HTML/CSS - I just want to specify a font preference list to be cascaded down to all text elements. Without this a BIRT user has to manually apply a font list to every text element. This is such a common requirement that there must be a way to do this in software that is as mature as BIRT. Any ideas?
As always, thank you for your help.
[Updated on: Thu, 02 April 2015 21:20] Report message to a moderator
|
|
| | | | | |
Goto Forum:
Current Time: Wed Apr 24 16:51:18 GMT 2024
Powered by FUDForum. Page generated in 0.03497 seconds
|