1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /* $Id: AFPEventProducer.java 1608161 2014-07-06 04:32:11Z gadams $ */ 19 20 package org.apache.fop.afp; 21 22 import org.apache.fop.events.EventBroadcaster; 23 import org.apache.fop.events.EventProducer; 24 25 /** 26 * Event producer interface for AFP-specific events. 27 */ 28 public interface AFPEventProducer extends EventProducer { 29 30 /** Provider class for the event producer. */ 31 static final class Provider { 32 Provider()33 private Provider() { 34 } 35 36 /** 37 * Returns an event producer. 38 * @param broadcaster the event broadcaster to use 39 * @return the event producer 40 */ get(EventBroadcaster broadcaster)41 public static AFPEventProducer get(EventBroadcaster broadcaster) { 42 return broadcaster.getEventProducerFor(AFPEventProducer.class); 43 } 44 } 45 46 /** 47 * Warn about using default font setup. 48 * 49 * @param source the event source 50 * @event.severity WARN 51 */ warnDefaultFontSetup(Object source)52 void warnDefaultFontSetup(Object source); 53 54 /** 55 * Warn about a missing default "any" font configuration. 56 * 57 * @param source the event source 58 * @param style the font style 59 * @param weight the font weight 60 * @event.severity WARN 61 */ warnMissingDefaultFont(Object source, String style, int weight)62 void warnMissingDefaultFont(Object source, String style, int weight); 63 64 /** 65 * A character set encoding error occurred. 66 * 67 * @param source the event source 68 * @param charSetName the character set name 69 * @param encoding the encoding 70 * @event.severity ERROR 71 */ characterSetEncodingError(Object source, String charSetName, String encoding)72 void characterSetEncodingError(Object source, String charSetName, String encoding); 73 74 /** 75 * Triggered when an external resource fails to be embedded. 76 * 77 * @param source the event source 78 * @param resourceName the name of the resource where the error occurred 79 * @param e the original exception 80 * @event.severity ERROR 81 */ resourceEmbeddingError(Object source, String resourceName, Exception e)82 void resourceEmbeddingError(Object source, String resourceName, Exception e); 83 84 /** 85 * A mandatory font configuration node is missing at location. 86 * @param source the event source 87 * @param missingConfig the expected configuration element 88 * @param location the position of the missing element within the config file. 89 * @event.severity ERROR 90 */ fontConfigMissing(Object source, String missingConfig, String location)91 void fontConfigMissing(Object source, String missingConfig, String location); 92 93 /** 94 * The character set given has an invalid name. 95 * @param source the event source 96 * @param msg the error message 97 * @event.severity ERROR 98 */ characterSetNameInvalid(Object source, String msg)99 void characterSetNameInvalid(Object source, String msg); 100 101 /** 102 * The code page for an AFP font could not be found. 103 * @param source the event source 104 * @param e the original exception 105 * @event.severity ERROR 106 */ codePageNotFound(Object source, Exception e)107 void codePageNotFound(Object source, Exception e); 108 109 /** 110 * This is a generic event for invalid configuration errors. 111 * @param source the event source 112 * @param e the original exception 113 * @event.severity ERROR 114 */ invalidConfiguration(Object source, Exception e)115 void invalidConfiguration(Object source, Exception e); 116 117 /** 118 * The characterset is missing metric information for the specified character 119 * @param source the event source 120 * @param character the character with missing metric information. 121 * @param charSet the character set containing missing metric information 122 * @event.severity WARN 123 */ charactersetMissingMetrics(Object source, char character, String charSet)124 void charactersetMissingMetrics(Object source, char character, String charSet); 125 126 /** 127 * Double-byte fonts are not currently supported in SVG. 128 * @param source the event source 129 * @param fontFamily name of DB font 130 * @event.severity WARN 131 */ invalidDBFontInSVG(Object source, String fontFamily)132 void invalidDBFontInSVG(Object source, String fontFamily); 133 } 134