You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2009/10/16 17:53:14 UTC

svn commit: r825964 - in /xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop: events/ fo/ fo/extensions/ fo/flow/ render/pdf/

Author: vhennebert
Date: Fri Oct 16 15:53:13 2009
New Revision: 825964

URL: http://svn.apache.org/viewvc?rev=825964&view=rev
Log:
Route message for missing alt-text property through event notification system

Modified:
    xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
    xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java
    xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
    xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
    xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml Fri Oct 16 15:53:13 2009
@@ -105,4 +105,5 @@
   <message key="org.apache.fop.fonts.FontEventAdapter.fontSubstituted">Font "{requested}" not found. Substituting with "{effective}".</message>
   <message key="org.apache.fop.fonts.FontEventAdapter.fontLoadingErrorAtAutoDetection">Unable to load font file: {fontURL}.[ Reason: {e}]</message>
   <message key="org.apache.fop.fonts.FontEventAdapter.glyphNotAvailable">Glyph "{ch}" (0x{ch,hex}[, {ch,glyph-name}]) not available in font "{fontName}".</message>
+  <message key="org.apache.fop.fo.FOValidationEventProducer.altTextMissing">Alternate text is missing on {foElement}.{{locator}}</message>
 </catalogue>

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java Fri Oct 16 15:53:13 2009
@@ -36,7 +36,9 @@
     /**
      * Provider class for the event producer.
      */
-    class Provider {
+    final class Provider {
+
+        private Provider() { }
 
         /**
          * Returns an event producer.
@@ -354,4 +356,13 @@
     void unknownFormattingObject(Object source, String elementName,
             QName offendingNode, Locator loc);
 
+    /**
+     * Alternate text is missing for a graphic element.
+     *
+     * @param source the event source
+     * @param foElement name of the element (external-graphic or instream-foreign-object)
+     * @param loc the location of the error or null
+     * @event.severity WARN
+     */
+    void altTextMissing(Object source, String foElement, Locator loc);
 }

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java Fri Oct 16 15:53:13 2009
@@ -47,7 +47,7 @@
         propertyAttributes.add("internal-destination");
         propertyAttributes.add("disable-column-balancing");
         //These are FOP's extension properties for accessibility
-        propertyAttributes.add("alt");
+        propertyAttributes.add("alt-text");
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java Fri Oct 16 15:53:13 2009
@@ -106,6 +106,12 @@
         scaling = pList.get(PR_SCALING).getEnum();
         textAlign = pList.get(PR_TEXT_ALIGN).getEnum();
         width = pList.get(PR_WIDTH).getLength();
+        if (getUserAgent().isAccessibilityEnabled()) {
+            String altText = pList.get(PR_X_ALT_TEXT).getString();
+            if (altText.equals("")) {
+                getFOValidationEventProducer().altTextMissing(this, getLocalName(), getLocator());
+            }
+        }
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java Fri Oct 16 15:53:13 2009
@@ -163,9 +163,6 @@
             if (altTextNode != null) {
                 structElem.put("Alt", altTextNode.getNodeValue());
             } else {
-                // TODO route that to event notification system
-//                log.warn("fo:" + s
-//                 + " requires an alternative text attribute fox:alt-text for accessibility");
                 structElem.put("Alt", "No alternate text specified");
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Re: Route message for missing alt-text property through event notification system

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Sun, Oct 18, 2009 at 05:33:34PM +0200, Jeremias Maerki wrote:
> Not sure if you consider this a cookbook recipe, but the event subsystem
> (client and developer side) is documented here:
> http://xmlgraphics.apache.org/fop/trunk/events.html
> 
> Let me know if that's insufficient.

The title, 'The producer side (for FOP developers)', sounds good. I
had not realized this documentation exists. I will look into it.

Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

Re: Route message for missing alt-text property through event notification system

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Not sure if you consider this a cookbook recipe, but the event subsystem
(client and developer side) is documented here:
http://xmlgraphics.apache.org/fop/trunk/events.html

Let me know if that's insufficient.

On 17.10.2009 10:59:35 Simon Pepping wrote:
> On Fri, Oct 16, 2009 at 03:53:14PM -0000, vhennebert@apache.org wrote:
> > Author: vhennebert
> > Date: Fri Oct 16 15:53:13 2009
> > New Revision: 825964
> > 
> > URL: http://svn.apache.org/viewvc?rev=825964&view=rev
> > Log:
> > Route message for missing alt-text property through event notification system
> 
> I should do that for the catalog resolver as well. Is there an
> instruction for this, preferably a cookbook recipe?
> 
> > Modified:
> >     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
> >     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java
> >     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
> >     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
> >     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java
> 
> Simon 
> 
> -- 
> Simon Pepping
> home page: http://www.leverkruid.eu




Jeremias Maerki


Re: Route message for missing alt-text property through event notification system

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Fri, Oct 16, 2009 at 03:53:14PM -0000, vhennebert@apache.org wrote:
> Author: vhennebert
> Date: Fri Oct 16 15:53:13 2009
> New Revision: 825964
> 
> URL: http://svn.apache.org/viewvc?rev=825964&view=rev
> Log:
> Route message for missing alt-text property through event notification system

I should do that for the catalog resolver as well. Is there an
instruction for this, preferably a cookbook recipe?

> Modified:
>     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
>     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java
>     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
>     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
>     xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java

Simon 

-- 
Simon Pepping
home page: http://www.leverkruid.eu