Hi Jeremias,

> Modified: 
> xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Typeface.java
> URL: 
> http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Typeface.java?rev=591583&r1=591582&r2=591583&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Typeface.java 
> (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Typeface.java Sat Nov 
>  3 03:51:31 2007
> @@ -27,6 +27,8 @@
>   */
>  public abstract class Typeface implements FontMetrics {
>  
> +    private long charMapOps = 0;
> +    
>      /**
>       * Get the encoding of the font.
>       * @return the encoding
> @@ -39,6 +41,23 @@
>       * @return the mapped character
>       */
>      public abstract char mapChar(char c);
> +
> +    /**
> +     * Used for keeping track of character mapping operations in order to 
> determine if a font
> +     * was used at all or not.
> +     */
> +    protected void notifyMapOperation() {
> +        this.charMapOps++;
> +    }
> +    
> +    /**
> +     * Indicates whether this font had to do any character mapping 
> operations. If that was 
> +     * not the case, it's an indication that the font has never actually 
> been used.
> +     * @return true if the font had to do any character mapping operations
> +     */
> +    public boolean hadMappingOperations() {
> +        return (this.charMapOps > 0);
> +    }

Basically you need to know whether the font has been used or not. Then 
why not just use a boolean for charMapOps?

Vincent

Reply via email to