/* ===================================================================== * JFreePDF : a fast, light-weight PDF library for the Java(tm) platform * ===================================================================== * * (C)opyright 2013-2022, by David Gilbert. All rights reserved. * * https://github.com/jfree/orsonpdf * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * * If you do not wish to be bound by the terms of the GPL, an alternative * runtime license is available to JFree sponsors: * * https://github.com/sponsors/jfree * */ package org.jfree.pdf; import java.awt.RenderingHints; /** * Defines the rendering hints that can be used with the {@link PDFGraphics2D} * class. There is just one hint defined at present:
* * * @since 1.5 */ public final class PDFHints { private PDFHints() { // no need to instantiate this } /** * The key for the hint that controls whether strings are rendered as * characters (standard PDF output) or vector graphics (implemented using * TextLayout). The latter will result in larger output files * but permits rendering Unicode characters without font embedding (which is * not supported by JFreePDF at this point). Valid hint * values are {@link #VALUE_DRAW_STRING_TYPE_STANDARD} and * {@link #VALUE_DRAW_STRING_TYPE_VECTOR}. */ public static final PDFHints.Key KEY_DRAW_STRING_TYPE = new PDFHints.Key(0); /** * Hint value for KEY_DRAW_STRING_TYPE to specify that strings * should be written to the output using standard PDF text primitives. */ public static final Object VALUE_DRAW_STRING_TYPE_STANDARD = "VALUE_DRAW_STRING_TYPE_STANDARD"; /** * Hint value for KEY_DRAW_STRING_TYPE to say that strings * should be written to the output using vector graphics primitives. */ public static final Object VALUE_DRAW_STRING_TYPE_VECTOR = "VALUE_DRAW_STRING_TYPE_VECTOR"; /** * A key for hints used by the {@link PDFGraphics2D} class. */ public static class Key extends RenderingHints.Key { /** * Creates a new instance with the specified key. * * @param privateKey the key. */ public Key(int privateKey) { super(privateKey); } /** * Returns {@code true} if {@code val} is a value that is * compatible with this key, and {@code false} otherwise. * * @param val the value. * * @return A boolean. */ @Override public boolean isCompatibleValue(Object val) { switch (intKey()) { case 0: return val == null || VALUE_DRAW_STRING_TYPE_STANDARD.equals(val) || VALUE_DRAW_STRING_TYPE_VECTOR.equals(val); default: throw new RuntimeException("Not expected!"); } } } }