I'll post it in the morning...I left my thumbdrive at work, so I don't have
my code with me.

-----Original Message-----
From: Leigh [mailto:[email protected]] 
Sent: Tuesday, September 14, 2010 2:56 PM
To: cf-talk
Subject: RE: ImageUtils.cfc and CFImage


>> We tried your code and the text you used worked great, but when 
>> we substituted other text, the image was not centered in the bounding >>
box and the bounding box was too small.

Yes, I am not all surprised. I think I mentioned it in the notes, but ...
since the focus of the entry was measurement, I doubt I spent much time on
dynamic positioning the bounding boxes. That is probably what you are
seeing. But if you check the actual dimensions returned, they should be
accurate.  At least within pixel or two ..

> How would you code an if or case statement
> properly to use the "javaStyle" for plain, bold, and
> italic?  


You could try something like this for the section that sets the style
 
( white space and comments removed for brevity...)

      .... other code ....

      <!--- Check for a defined style. --->
      <cfif StructKeyExists( ARGUMENTS.FontProperties, "Style" )>
         <cfswitch expression="#ARGUMENTS.FontProperties.Style#">
            <cfcase value="Bold">
               <cfset LOCAL.FontStyleMask = LOCAL.CurrentFont.BOLD />
            </cfcase>
            <cfcase value="Italic">
               <cfset LOCAL.FontStyleMask = LOCAL.CurrentFont.ITALIC  />
            </cfcase>
            <cfcase value="BoldItalic">
               <cfset LOCAL.FontStyleMask = BitOR(
                                       LOCAL.CurrentFont.BOLD,
                                       LOCAL.CurrentFont.ITALIC
                                    ) />
            </cfcase>
            <!--- Otherwise, just use the default PLAIN style --->
            <cfdefaultcase>
               <cfset LOCAL.FontStyleMask = LOCAL.CurrentFont.PLAIN  />
            </cfdefaultcase>
         </cfswitch>
      <cfelse>
         <cfset LOCAL.FontStyleMask = LOCAL.CurrentFont.PLAIN />
      </cfif>

      ... rest of code .....    
    
       <!--- 
         ASSERT: At this point, we have fully set up our font ...
      --->



> we have the issue of the vertical centering
> not being right.  

Well for vertical centering you may need to take into account the text
"baseline".  Can you post an small example of what you are using? ie
Something that demonstrates the wrong results?


-Leigh


    



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337018
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to