001/**
002 * Copyright (c) 2011, The University of Southampton and the individual contributors.
003 * All rights reserved.
004 *
005 * Redistribution and use in source and binary forms, with or without modification,
006 * are permitted provided that the following conditions are met:
007 *
008 *   *  Redistributions of source code must retain the above copyright notice,
009 *      this list of conditions and the following disclaimer.
010 *
011 *   *  Redistributions in binary form must reproduce the above copyright notice,
012 *      this list of conditions and the following disclaimer in the documentation
013 *      and/or other materials provided with the distribution.
014 *
015 *   *  Neither the name of the University of Southampton nor the names of its
016 *      contributors may be used to endorse or promote products derived from this
017 *      software without specific prior written permission.
018 *
019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
020 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
021 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
022 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
023 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
026 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
028 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029 */
030/**
031 * 
032 */
033package org.openimaj.image.typography.general;
034
035import org.openimaj.image.renderer.ImageRenderer;
036import org.openimaj.image.typography.FontStyle;
037
038/**
039 *      This is a wrapper and extensions for the Java AWT Font as an OpenIMAJ
040 *      Font style.
041 *
042 *      @author David Dupplaw (dpd@ecs.soton.ac.uk)
043 *  @created 18 Aug 2011
044 *      
045 *
046 *      @param <T> The pixel type
047 */
048public class GeneralFontStyle<T> extends FontStyle<T>
049{
050        /** Whether to draw the font as outline or not */
051        private boolean outline = false;
052
053        /**
054         *      Create a new font style that will be drawn solid.
055         * 
056         *      @param font The font to use
057         *      @param renderer The renderer to draw with
058         */
059        public GeneralFontStyle( final GeneralFont font, final ImageRenderer<T, ?> renderer )
060        {
061                this( font, renderer, false );
062        }
063
064        /**
065         *      Create a new GeneralFontStyle.
066         * 
067         *      @param font The font to use (must be a {@link GeneralFont})
068         *      @param renderer The renderer to draw with
069         *      @param outline Whether to draw in outline or not
070         */
071        public GeneralFontStyle( final GeneralFont font, final ImageRenderer<T, ?> renderer,
072                        final boolean outline )
073        {
074                super( font, renderer );
075                this.outline = outline;
076        }
077
078        /**
079         *      Set whether this font should be drawn in outline or not.
080         *      @param outline Whether to draw in outline or not
081         */
082        public void setOutline( final boolean outline )
083        {
084                this.outline = outline;
085        }
086
087        /**
088         *      Returns whether this font is to be drawn in outline or not
089         *      @return Whether the font will be drawn in outline or not
090         */
091        public boolean isOutline()
092        {
093                return this.outline;
094        }
095}