Managed Hosting



Project Home Known Issues Contact Project

ImageUtils Issue: getCenteredTextPosition doesn't account for bolditalic

Name: getCenteredTextPosition doesn't account for bolditalic
ID: 6
Project: ImageUtils
Type: Enhancement
Area: Code
Severity: Low
Status: Open
Related URL:
Creator: Charlie Griefer
Created: 11/21/10 2:32 PM
Updated: 11/21/10 2:32 PM
Description: Lines 1048-1055:

      <!--- possibly refactor --->   
      <cfif arguments.fonttype is "plain">
         <cfset fp = font.PLAIN>
      <cfelseif arguments.fonttype is "bold">
         <cfset fp = font.BOLD>
         <cfset fp = font.ITALIC>

font.BOLD (1) and font.ITALIC (2) work a treat. But there's no condition for boldItalic, which can be accomplished via a bitwise union of BOLD and ITALIC (e.g. 1|2).

refactored the lines above to read:

      switch ( fonttype ) {
         case "bold":
            fp = font.BOLD;
         case "italic":
            fp = font.ITALIC;
         case "bolditalic":
            fp = bitOr( font.BOLD, font.ITALIC);
            fp = font.PLAIN;

Notice the bitOr() under the "bolditalic" case. That seems to work ("seems to" meaning that it's not throwing an error, but I haven't tested extensively to ensure that both the bold and italic properties are being applied) :)
History: Created by cgriefer (Charlie Griefer) : 11/21/10 2:32 PM

To add a comment to this bug, please login using the link above.