Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the Tagging Project #1370

Open
u-fischer opened this issue Oct 30, 2024 · 0 comments
Open

Support for the Tagging Project #1370

u-fischer opened this issue Oct 30, 2024 · 0 comments

Comments

@u-fischer
Copy link
Contributor

u-fischer commented Oct 30, 2024

Brief outline of the proposed feature

I'm currently trying to implement some first support to properly tag tikz pictures and have a few request to tikz/pgf here.

Predefine and reserve the keys alt and actualtext and artifact.

In various cases user will have to provide an alternative text or an actualtext for a picture or declare that the graphic is only decoration (and artifact):

\begin{tikzpicture}[alt=A duck]
\duck
\end{tikzpicture}

I will provide the needed tagging code, but it would be nice if tikz would predefine the keys for this purpose so that users can add such texts even if tagging is not active (\includegraphics knows the alt keys already too and I will add actualtext).

It would be also nice, if tikz could process these keys earlier, so that one knows which tagging is needed before the figure is started.

Interface for tagging code around nodes.

I must be able to add tagging code around nodes. Currently I'm redefining for this two internal commands of pgf:

   \def\pgfsys@begin@text
    {
      \bool_if:NT\l__tag_tikzpicture_usetext_bool
        {\ResumeTagging{\tikzpicture}} 
      \tag_socket_use:n{tikzpicture/textbegin}
    }
   \def\pgfsys@end@text
    {
      \tag_socket_use:n{tikzpicture/textend}
      \bool_if:NT\l__tag_tikzpicture_usetext_bool
        {\SuspendTagging{\tikzpicture} } 
    }

This looks more or less ok: as far as I could see the commands are only used for postscript + svg where tagging is not active. But dedicated commands at the same place would be better.

Getting the BBox

In some case I have to calculate the BBox, these are the absolute coordinates on the page of the bottom/left and top/right corners of the picture. I'm using remember picture and then the following code to calculate the coordinates. This works fine (I currently do not care about cases where parts of the picture are outside the bounding box), but here too it would be nice, if there were a public tikz command that one could use:

% redefine `\pgfqpoint` locally and then call  `pgf@sys@pdf@mark@pos@pgfid\the\pgf@picture@serial@count`:
   \cs_set:Npn\pgfqpoint##1##2
    {         
      \dim_to_decimal_in_bp:n {##1+ \pgf@picminx}
      \c_space_tl
      \dim_to_decimal_in_bp:n {##2+ \pgf@picminy}
      \c_space_tl
      \dim_to_decimal_in_bp:n {##1+ \pgf@picmaxx}
      \c_space_tl
      \dim_to_decimal_in_bp:n {##2+ \pgf@picmaxx}          
    }   
   \cs_if_exist:cT { pgf@sys@pdf@mark@pos@pgfid\the\pgf@picture@serial@count }
    {
      \__tag_prop_gput:cne
        { g__tag_struct_ \g__tag_struct_stack_current_tl _prop }
        { A } 
        {
           << 
             /O /Layout /BBox~
             [
               \use:c 
                { pgf@sys@pdf@mark@pos@pgfid\the\pgf@picture@serial@count }
             ]
           >>   
        }
     }

Usage example

No response

@u-fischer u-fischer added this to the 3.1.11 milestone Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant