Edgewall Software

Opened 17 years ago

Closed 12 years ago

Last modified 12 years ago

#2645 closed defect (fixed)

Report custom formatting: font styles not honored

Reported by: kilian.cavalotti@… Owned by: whueskes@…
Priority: lowest Milestone: 0.12.1
Component: report system Version: 0.9.3
Severity: normal Keywords: style report font
Cc: whueskes@…, dgc+trac@… Branch:
Release Notes:
API Changes:
Internal Changes:


I have a problem with reports custom formatting: when using style to change font properties, the specified style is not applied. The following example, given in TracReports, illustrates the problem :

SELECT p.value AS __color__,
     t.milestone AS __group__,
     (CASE owner WHEN '$USER' THEN 'font-weight: bold; background: red;' ELSE 
'' END) AS __style__,
       t.id AS ticket, summary
  FROM ticket t,enum p
  WHERE t.status IN ('new', 'assigned', 'reopened') 
    AND p.name=t.priority AND p.type='priority'
  ORDER BY t.milestone, p.value, t.severity, t.time

Using this report, I correctly see my tickets with a red background, but the font weight is normal. I assume that's because the style="font-weight:bold" attribute is passed to the <tr> tag, when it should probably be passed to each <td> element.


(CASE owner WHEN '$USER' THEN 'font-weight: bold;' ELSE '' END) AS __style__,

the generated HTML looks like below:

<tr class="color2-odd" style="font-weight: bold;">
    <td class="ticket">
        <a title="View ticket" href="/trac/ticket/52"> #52 </a>
    <td class="component"> trac </td>
    <td class="status"> new </td>
    <td class="type"> task </td>
    <td class="priority"> high </td>
    <td class="severity"> normal </td>
    <td class="owner"> kilian </td>
    <td class="date"> 01/17/06 </td>

Attachments (0)

Change History (12)

comment:1 by whueskes@…, 17 years ago

Cc: whueskes@… added

Workaround: change in htdocs/css/trac.css

body, th, td {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;


body, th {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;

comment:2 by whueskes@…>, 17 years ago

or even better:

body, th, tr {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;

comment:3 by Christian Boos, 16 years ago

Milestone: 2.0
Priority: normallowest

Perhaps related to #633?

comment:4 by whueskes@…, 16 years ago

the (second) workaround is working fine for me.

Here is a test case: http://www.hosted-projects.com/trac/TracDemo/Demo/report/14
The background color is applied, but the font is not made bold.
When I edit the css using https://addons.mozilla.org/firefox/60/, I see no other visual change except that line becoming bold, but I am no css expert, so there might be situations or browsers where it does change something.

Changing the DOCTYPE might also solve the problem: (google groups)

comment:5 by Christian Boos, 15 years ago

Summary: Repoort custom formatting: font styles not honoredReport custom formatting: font styles not honored

comment:6 by osimons, 15 years ago

#5128 closed as a duplicate. It contains some related discussion, and identification of a code change that solved it using 0.10.4.

comment:7 by anonymous, 14 years ago

Changing the trac.css as follows should fix the issue:

body {
 font: normal 13px Verdana,Arial,'Bitstream Vera Sans',Helvetica,sans-serif;

th, td {
 font: inherit;

comment:8 by dgc+trac@…, 13 years ago

Cc: dgc+trac@… added

I'm surprised this ticket is still open. Is there a reason not to make the change above in the distributed trac.css? Seems like a simple solution to a vexing and common problem.

I don't like modifying my trac.css — I don't ever like local customizations to distributed code if I can help it. I solved this problem by creating a local style.css with the following:

tr th,td {
    text-decoration: inherit;
    text-transform: inherit;
    font-size: inherit;
    font-style: inherit;
    font-weight: inherit;

Now my reports' <tr> style attributes are inherited by their <td>s.

comment:9 by Christian Boos, 12 years ago

Milestone: 2.0unscheduled

Milestone 2.0 deleted

comment:10 by Remy Blank, 12 years ago

Milestone: triaging0.13
Owner: changed from daniel to Remy Blank

comment:11 by Remy Blank, 12 years ago

Resolution: fixed
Status: newclosed

Applied the suggestion in comment:2 in [9954].

comment:12 by Remy Blank, 12 years ago

Owner: changed from Remy Blank to whueskes@…

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain whueskes@….
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from whueskes@… to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.