[API REVIEW] RT-27883: move Size and SizeUnits to public API

Richard Bair richard.bair at oracle.com
Thu Jan 24 14:13:29 PST 2013


>>> public double calculateValue(Font font) - calculate the actual value using the size of the given font if the units are font-relative or percentage 
>>> public double calculateValue(double multiplier) - calculate the actual value using the multiplier if the units are font-relative or percentage 
>> 
>> How does this work? Do these methods simply return a multiplier?
> 
> They take the value and apply the unit conversion. So, for example, if you have 2em, the EM SizeUnit implementation of calculateValue returns 2 * font.getSize(). 2rad returns 2*180/Math.PI. Rather than having Size figure out what calculation to use in some big switch statement, SizeUnits knows how to do the calculation. If we add more SizeUnits, all that needs to be done is the implementation of calculateValue. 

So there is more to the method than  just calculateValue(Font)? Is it calculateValue(Font, inputSize) or whatever?




More information about the openjfx-dev mailing list