%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% AFNOR SPEC S76-001
%   27 Mars 2020
%
% Patron du Masque barrière « à plis »
%
% Licensed under CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
%
% Generate with lualatex
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[a4paper]{minimal}
%\documentclass[a3paper]{minimal}
\usepackage[]{fontspec}
\usepackage[includeheadfoot, margin=0cm, top=1cm, paper=a4paper]{geometry}
%\usepackage[includeheadfoot, margin=0cm, top=1cm, paper=a3paper]{geometry}
\usepackage[rgb]{xcolor}
\usepackage[]{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
 \usepackage[]{ccicons}
\RequirePackage{luatex85} % for geometry

% https://tex.stackexchange.com/questions/245964/unicode-in-pdf-metadata
% \protected\def\pdfinfo{\pdfextension info}
% \pdfinfo{
% /Title (AFNOR SPEC S76-001 - Patron du Masque barrière « à plis »)
% % /Author (Fabrice Salvaire)
% }
\usepackage[
  pdfencoding=auto,% or unicode
  psdextra,
]{hyperref}
\hypersetup{
  pdftitle={AFNOR SPEC S76-001 - Patron du Masque barrière « à plis »},
  pdfauthor={Fabrice Salvaire},
}

\def\myarrow{{Latex[length=4mm,width=3mm]}}

% Warning: command like \huge are not defined in minimal documentclass
\begin{document}
\begin{center}
  \setmainfont[Ligatures=TeX]{Latin Modern Sans}
  \fontsize{18pt}{20pt}\selectfont AFNOR SPEC S76-001 \\[5mm]
  \fontsize{14pt}{16pt}\selectfont Patron du Masque barrière « à plis » \\[10mm]
  \fontsize{12pt}{14pt}\selectfont
  \begin{tikzpicture}[x=1mm,y=1mm]
    \coordinate (origin) at (0,0);
    \coordinate (top) at (0,200);
    \coordinate (east) at (200,0);
    \coordinate (corner) at (200,200);
    \coordinate (center) at ($(origin)!.5!(corner)$);

    \coordinate (B2l) at (0,25);
    \coordinate (B0l) at (0,25*2);
    \coordinate (B1l) at (0,25*3);
    \coordinate (A1l) at (0,200-25*3);
    \coordinate (A0l) at (0,200-25*2);
    \coordinate (A2l) at (0,200-25);

    \coordinate (B2r) at ($ (B2l) + (200,0) $);
    \coordinate (B0r) at ($ (B0l) + (200,0) $);
    \coordinate (B1r) at ($ (B1l) + (200,0) $);
    \coordinate (A2r) at ($ (A2l) + (200,0) $);
    \coordinate (A0r) at ($ (A0l) + (200,0) $);
    \coordinate (A1r) at ($ (A1l) + (200,0) $);

    \coordinate (B2lm) at ($ (origin)!.5!(B2l) $);
    \coordinate (B0lm) at ($ (B0l)!.5!(B2l) $);
    \coordinate (B1lm) at ($ (B1l)!.5!(B0l) $);
    \coordinate (A2lm) at ($ (top)!.5!(A2l) $);
    \coordinate (A0lm) at ($ (A0l)!.5!(A2l) $);
    \coordinate (A1lm) at ($ (A1l)!.5!(A0l) $);

    \coordinate (Mbl) at ($ (origin) + (0,12) $);
    \coordinate (Mtl) at ($ (top) - (0,12) $);

    \draw [line width=1pt] (origin) rectangle (corner);
    \node[anchor=south] at ($(origin)!.5!(east)$) {carré de 20 cm};

    \draw [dashed] ($ (origin) - (5,5) $) rectangle ($ (corner) + (5,5) $);
    \node[anchor=north] at ($(origin)!.5!(east)$) {marge couteau raseur 5 mm, carré de 21 cm};

    \draw[dashed] (B2l) -- (B2r);
    \draw[dashed,line width=1pt] (B0l) -- (B0r);
    \draw[dashed] (B1l) -- (B1r);
    \draw[dashed] (A2l) -- (A2r);
    \draw[dashed,line width=1pt] (A0l) -- (A0r);
    \draw[dashed] (A1l) -- (A1r);

    \draw[line width=2pt] (B2l) -- +(10,0);
    \draw[line width=2pt] (B1l) -- +(10,0);
    \draw[line width=2pt] (A2l) -- +(10,0);
    \draw[line width=2pt] (A1l) -- +(10,0);

    \draw[line width=2pt] (B2r) -- +(-10,0);
    \draw[line width=2pt] (B1r) -- +(-10,0);
    \draw[line width=2pt] (A2r) -- +(-10,0);
    \draw[line width=2pt] (A1r) -- +(-10,0);

    \node[anchor=west, xshift=1cm] at (A1l) {\textbf{A1}};
    \node[anchor=west, xshift=1cm] at (A2l) {\textbf{A2}};
    \node[anchor=west, xshift=1cm] at (B1l) {\textbf{B1}};
    \node[anchor=west, xshift=1cm] at (B2l) {\textbf{B2}};

    \node[anchor=east, xshift=-1cm] at (A1r) {\textbf{A1$^\prime$}};
    \node[anchor=east, xshift=-1cm] at (A2r) {\textbf{A2$^\prime$}};
    \node[anchor=east, xshift=-1cm] at (B1r) {\textbf{B1$^\prime$}};
    \node[anchor=east, xshift=-1cm] at (B2r) {\textbf{B2$^\prime$}};

    \node[anchor=west] at (A0lm) {25 mm};
    \node[anchor=west] at (A1lm) {25 mm};
    \node[anchor=west] at (A2lm) {25 mm};
    \node[anchor=west] at ($ (A1l)!.5!(B1l) $) {50 mm};
    \node[anchor=west] at (B0lm) {25 mm};
    \node[anchor=west] at (B1lm) {25 mm};
    \node[anchor=west] at (B2lm) {25 mm};

    \draw[dotted] ($ (origin) + (10,10) $) rectangle ($ (corner) - (10,10) $);
    % \draw[dotted] ($ (east) - (80,0) + (0,10) $) -- ($ (east) - (10,0) + (0,10) $) -- +(0,80);
    \node[shape=circle,draw,inner sep=2pt] at ($ (east) - (16.5em, 0) +(0,1.5em) $) {1};
    \node[anchor=south east, text width=15em] at (east) {glacer le pourtour à 1 cm du bord, point 504 surfilage à 3 fils};

    \draw[dotted] (Mtl) -- +(200,0);
    \draw[dotted] (Mbl) -- +(200,0);
    \node[anchor=south,shape=circle,draw,inner sep=2pt,yshift=3mm] at ($ (Mtl) + (100,0) $) {2};
    \node[anchor=north] at ($ (Mtl) + (100,0) $) {ourlet de 12 mm en haut et en bas, point droit 301 à 2 mm du bord};
    \node[anchor=south] at ($ (Mbl) + (100,0) $) {ourlet idem};

    \node[anchor=south] at ($ (A0l)!.5!(A0r) $) {axe de pliure};
    \node[anchor=south] at ($ (B0l)!.5!(B0r) $) {axe de pliure};
    \draw[line width=1pt, rounded corners=1mm] (center) -- ++(0, 25) -- ++(-60:25) -- ++(0, 50-12) -- ++(-60:12);
    \draw[line width=1pt, rounded corners=1mm] (center) -- ++(0,-25) -- ++( 60:25) -- ++(0,-50+12) -- ++( 60:12);
    \draw[\myarrow-\myarrow] ($ (center) + (-3,-5) $) -- ++(0, 25+5);
    \node[anchor=south] at ($ (center) + (0,25) $) {A1};
    \node[anchor=south east] at ($ (center) + (12,25) $) {A2};
    \coordinate (n3) at ($ (center) + (-9em,15) $);
    \node[anchor=south,shape=circle,draw,inner sep=2pt] at (n3) {3};
    \node[anchor=north, text width=17em] at (n3) {
      piquer les 4 plis, en pliant A1 sur A2,
      point bartack ou 301 avant/arrière,
      répéter l'opération sur les 3 autres plis
    };
  \end{tikzpicture} \\[10mm]
  Monter 2 élastiques de 35 cm au en haut et en bas, point bartack aux quatres coins \\[10mm]
  \fontsize{8pt}{10pt}\selectfont
  This document is licensed under CC BY-NC-SA 4.0 \\
  \url{https://creativecommons.org/licenses/by-nc-sa/4.0/}
\end{center}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
