You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FontEventProducer.java 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. /* $Id$ */
  18. package org.apache.fop.fonts;
  19. import org.apache.fop.events.EventBroadcaster;
  20. import org.apache.fop.events.EventProducer;
  21. import org.apache.fop.events.model.AbstractEventModelFactory;
  22. import org.apache.fop.events.model.EventModel;
  23. /**
  24. * Event producer for fonts-related events.
  25. */
  26. public interface FontEventProducer extends EventProducer {
  27. /**
  28. * Provider class for the event producer.
  29. */
  30. final class Provider {
  31. private Provider() { }
  32. /**
  33. * Returns an event producer.
  34. * @param broadcaster the event broadcaster to use
  35. * @return the event producer
  36. */
  37. public static FontEventProducer get(EventBroadcaster broadcaster) {
  38. return (FontEventProducer) broadcaster.getEventProducerFor(FontEventProducer.class);
  39. }
  40. }
  41. /** Event model factory for Accessibility. */
  42. public static class EventModelFactory extends AbstractEventModelFactory {
  43. /** {@inheritDoc} */
  44. public EventModel createEventModel() {
  45. return loadModel(getClass(), "event-model.xml");
  46. }
  47. }
  48. /**
  49. * Notifies about a font being substituted as the requested one isn't available.
  50. * @param source the event source
  51. * @param requested the requested font triplet
  52. * @param effective the effective font triplet
  53. * @event.severity WARN
  54. */
  55. void fontSubstituted(Object source, FontTriplet requested, FontTriplet effective);
  56. /**
  57. * An error occurred while loading a font for auto-detection.
  58. * @param source the event source
  59. * @param fontURL the font URL
  60. * @param e the original exception
  61. * @event.severity WARN
  62. */
  63. void fontLoadingErrorAtAutoDetection(Object source, String fontURL, Exception e);
  64. /**
  65. * A glyph has been requested that is not available in the font.
  66. * @param source the event source
  67. * @param ch the character for which the glyph isn't available
  68. * @param fontName the name of the font
  69. * @event.severity WARN
  70. */
  71. void glyphNotAvailable(Object source, char ch, String fontName);
  72. }