#2645 closed defect (fixed)
Report custom formatting: font styles not honored
| Reported by: | Owned by: | ||
|---|---|---|---|
| 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: | |||
Description
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.
With
(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>
    <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>
</tr>
      Attachments (0)
Change History (12)
comment:1 by , 20 years ago
| Cc: | added | 
|---|
comment:2 by , 20 years ago
or even better:
body, th, tr {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
} 
comment:4 by , 19 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 , 18 years ago
| Summary: | Repoort custom formatting: font styles not honored → Report custom formatting: font styles not honored | 
|---|
comment:6 by , 18 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 , 17 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 , 16 years ago
| Cc: | 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:10 by , 15 years ago
| Milestone: | triaging → 0.13 | 
|---|---|
| Owner: | changed from to | 
comment:11 by , 15 years ago
| Milestone: | 0.13 → 0.12.1 | 
|---|---|
| Resolution: | → fixed | 
| Status: | new → closed | 
comment:12 by , 15 years ago
| Owner: | changed from to | 
|---|



  
Workaround: change in htdocs/css/trac.css
body, th, td { font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif; }into:
body, th { font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif; }