View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0013879 | mantisbt | reports | public | 2012-02-09 12:50 | 2016-07-19 04:19 |
Reporter | TomasC | Assigned To | vboctor | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | git trunk | ||||
Target Version | 2.0.0-beta.1 | Fixed in Version | 2.0.0-beta.1 | ||
Summary | 0013879: Graph plugin uses hard coded font list; ignores any other | ||||
Description | The Graph plugin contains a hard coded list of fonts. Despite any (plugin) configuration setting you make, the code does not allow any other font to be specified. Since these are mostly Windows fonts and most Linux servers don't have these pre-installed, it would probably be better to allow the user to specify the font themselves or select one from a list obtained from the system ( This would also mean the dependency of the Mantis Graph plugin on the corefonts/msfonts package can be dropped. | ||||
Steps To Reproduce |
| ||||
Additional Information | Attached patch (works on 1.2.8 and current Git trunk) simply removes the mapping as a proof of concept. You still need to set the font configuration option to a font existing on your system (ls /usr/share/fonts/truetype), for example "DejaVuSans.ttf". In the Graph plugin, in core/graph_api.php, in function graph_get_font(): if( isset( $t_font_map[$t_font] ) ) { | ||||
Tags | No tags attached. | ||||
Attached Files | mantis_graph_font_unhardcode.patch (458 bytes)
57,73d56 < $t_font_map = array( < 'arial' => 'arial.ttf', < 'verdana' => 'verdana.ttf', < 'trebuchet' => 'trebuc.ttf', < 'verasans' => 'Vera.ttf', < 'times' => 'times.ttf', < 'georgia' => 'georgia.ttf', < 'veraserif' => 'VeraSe.ttf', < 'courier' => 'cour.ttf', < 'veramono' => 'VeraMono.ttf', < ); < < if( isset( $t_font_map[$t_font] ) ) { < $t_font = $t_font_map[$t_font]; < } else { < $t_font = 'arial.ttf'; < } mantis_graph_font_config_unhardcode.patch (1,420 bytes)
119,133c119,120 < <td style="vertical-align: top"> < Sans-serif:<br /> < <label><input type="radio" name="font" value="arial"<?php echo print_font_checked( 'arial' )?>/>Arial</label><br /> < <label><input type="radio" name="font" value="verdana"<?php echo print_font_checked( 'verdana' )?>/>Verdana</label><br /> < <label><input type="radio" name="font" value="trebuchet"<?php echo print_font_checked( 'trebuchet' )?>/>Trebuchet</label><br /> < <label><input type="radio" name="font" value="verasans"<?php echo print_font_checked( 'verasans' )?>/>Vera Sans</label> < </td> < <td style="vertical-align: top"> < Serif:<br /> < <label><input type="radio" name="font" value="times"<?php echo print_font_checked( 'times' )?>/>Times</label><br /> < <label><input type="radio" name="font" value="georgia"<?php echo print_font_checked( 'georgia' )?>/>Georgia</label><br /> < <label><input type="radio" name="font" value="veraserif"<?php echo print_font_checked( 'veraserif' )?>/>Vera Serif</label><br /> < <br />Monospace:<br /> < <label><input type="radio" name="font" value="courier"<?php echo print_font_checked( 'courier' )?>/>Courier</label><br /> < <label><input type="radio" name="font" value="veramono"<?php echo print_font_checked( 'veramono' )?>/>Vera Mono</label> --- > <td class="center" colspan="2"> > <input type="text" name="font" value="<?php echo plugin_config_get( 'font' )?>" /> mantis_graph_font_configedit_unhardcode.patch (376 bytes)
48,62c48 < switch ( $f_font ) { < case 'arial': < case 'verdana': < case 'trebuchet': < case 'verasans': < case 'times': < case 'georgia': < case 'veraserif': < case 'courier': < case 'veramono': < plugin_config_set( 'font', $f_font ); < break; < default: < plugin_config_set( 'font', 'arial' ); < } --- > plugin_config_set( 'font', $f_font ); | ||||