+
    ̧6j2                     $   R t Rt^ RIt^ RIHt ^ RIHt ^ RIHtH	t	 ^ RI
HtHtHt ^ RIHt ^ RIHt ^ R	IHt R
RRRRRRR/t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      tR t ! R R]4      tR t]R8X  d
   ]! 4        R# R# )z3.3.0aL  Routines to print code page (character set) drawings. Predates unicode.

To be sure we can accurately represent characters in various encodings
and fonts, we need some routines to display all those characters.
These are defined herein.  The idea is to include flowable, drawable
and graphic objects for single and multi-byte fonts. N)Canvas)Flowable)
pdfmetricscidfonts)GroupStringRect)Widget)colors)int2ByteWinAnsiEncodingwinansiMacRomanEncodingmacroman	MacExpert	macexpertPDFDocpdfdocc                   @   a  ] tR t^t o RtR tR tR tRR ltRt	V t
R# )	CodeChartBasezjBasic bits of drawing furniture used by
single and multi-byte versions: ability to put letters
into boxes.c                   V P                   R,          V P                  ,          pV\        V4      8X  d   \        V4      V n        M\        V4      ^,           V n        V P                  ^V P                  ,           ,          V n        V P                  ^V P                  ,           ,          V n        . V n        \        V P                  ^,           4       F.  pV P                  P                  W P                  ,          4       K0  	  . V n
        \        V P                  ^,           4       F.  pV P                  P                  W0P                  ,          4       K0  	  R# )z&Work out x and y positions for drawingg      ?N)
codePointscharsPerRowintrowsboxSizewidthheightylistrangeappendxlist)selfr   rowcols   &   P/opt/hart-platform/venv/lib/python3.14/site-packages/reportlab/lib/codecharts.py
calcLayoutCodeChartBase.calcLayout#   s     $t'7'773t9D	DID	ADI\\Qt'7'7%78
lla		k2 
Q'CJJcLL01 (
))A-.CJJcLL01 /    c                J    V P                   '       d
   R V,          # RV,          # )%02Xz%d)hex)r"   byts   &&r%   
formatByteCodeChartBase.formatByte8   s    888C<#:r(   c                   V P                   V P                  ,          \        V4      ,
          p\        V4       F  pVP	                  R4       K  	  ^ p^ pV P
                  P                  V P                  V P                  R,          4       V EF;  pVf   V P
                  P                  R4       V P
                  P                  ^V,           V P                  ,          V P                   V,
          ^,
          V P                  ,          V P                  V P                  ^ ^R7       V P
                  P                  R4       M_ V P
                  P                  VR,           V P                  ,          V P                   V,
          R,
          V P                  ,          V4       V^,           pWPP                  8X  g   EK0  V^,           p^ pEK>  	  R#    T P
                  P                  R4       T P
                  P                  ^T,           T P                  ,          T P                   T,
          ^,
          T P                  ,          T P                  T P                  ^ ^R7       T P
                  P                  TR,           T P                  ,          T P                   T,
          R,
          T P                  ,          R4       T P
                  P                  R4        EL=; i)	zUFills boxes in order.  None means skip a box.
Empty boxes at end get filled with grayN      ?g?strokefill              ?g      ??)r   r   lenr   r    canvsetFontfontNamer   setFillGrayrectdrawCentredString)r"   charListextraNeededir#   r$   chs   &&     r%   	drawCharsCodeChartBase.drawChars>   s    yy4#3#33c(mC{#AOOD! $ 		$--)<=Bz		%%c*		#5		C!8Kt||7[LL$,,qq  B		%%c*/II// W4!YY_u4D 'C&&&Ag5 	/II))#.IINNAcET\\#9DIIOa<OSWS_S_;_dll11 # FII// W4!YY_u4D
 II))#.s   AGDKc           	     Z   V P                   P                  R4       V P                   P                  ^ V P                  R,          V P                  V P
                  ^^ R7       V P                   P                  ^ ^ V P
                  V P                  R,          ^^ R7       V P                   P                  R4       V P                   P                  RRV P
                  ,          4       ^ p\        V P                  4       F  pV P                  '       d   V P                  V,          pM!V P                  W0P                  ,          4      pV P                   P                  RV P
                  ,          V P                  V,
          R,
          V P
                  ,          V4       K  	  \        V P                  4       Fi  pV P                   P                  VR,           V P
                  ,          V P                  R	,           V P
                  ,          V P                  V4      4       Kk  	  V'       d   V P                   P                  R
RV P
                  ,          4       V P                   P                  RV P
                  ,          V P                  R	,           V P
                  ,          V4       R# R# )z4Writes little labels in the top row and first column皙?)r3   r2   r4   zHelvetica-Obliqueg      ?g      ?r0   r5   g      ?zHelvetica-BoldObliqueN)r8   r;   r<   r   r   r   r9   r   r   	rowLabelsr-   r   r=   )r"   topLeftr,   r#   labelr$   s   &&    r%   
drawLabelsCodeChartBase.drawLabelsd   s   		c"		q$**R.$**dllSTU		q!T\\4::b>!L		c" 			-edll.BC#C~~~s+.>.>(>?II''dll(:)-S4)?4<<(O(-* $ ))*CII''sdll(B)-T)9T\\(I(,(<* + II5cDLL6HIII''dll(:)-T)9T\\(I(/* r(   )r   r   r   r!   r   N) )__name__
__module____qualname____firstlineno____doc__r&   r-   rB   rJ   __static_attributes____classdictcell____classdict__s   @r%   r   r      s$     2*$L* *r(   r   c                   0   a  ] tR t^t o RR ltR tRtV tR# )SingleByteEncodingChartc                d   R V n         Wn        W n        V P                  R,           V P                  ,           V n        W0n        W@n        WPn        RV n        \        P                  ! \        P                  ! V P                  V P                  V P                  4      4       V P                  4        R# )   -N)r   faceNameencodingNamer:   r   r   r+   rG   r   registerFontFontr&   )r"   r[   r\   r   r   r+   s   &&&&&&r%   __init__ SingleByteEncodingChart.__init__   s     (+d.?.??&
04040A0A!C 	"
 	r(   c                  a V P                  4        R .^ ,          \        \        \        \        \	        ^ R4      4      4      4      ,           pV P
                  p\        P                  W"4      p\        P                  ! V4      ^,          oV3R lpV Uu. uF
  qC! V4      NK  	  ppV P                  V4       V P                  P                  V P                  V P                  4       R # u upi )NrY   c                 2   < V f   R # S! V RR7      ^ ,          # )Nreplace)errors )txtdecoders   &r%   
decodeFunc0SingleByteEncodingChart.draw.<locals>.decodeFunc   s    {s95a88r(   )rJ   listmapr   r   r\   adobe2codecgetcodecslookuprB   r8   gridr!   r   )r"   r>   encNamerh   rA   rg   s   &    @r%   drawSingleByteEncodingChart.draw   s    6B;c(Dr34H&I!JJ
 ##//'3--(+	9 .66XrJrNX6 	x 		tzz4::. 7s   C*)r   r   r   r\   r[   r:   r+   rG   N)	Helveticar            )rM   rN   rO   rP   r_   rr   rR   rS   rT   s   @r%   rW   rW      s     $/ /r(   rW   c                   6   a  ] tR t^t o RtR tR tR tRtV t	R# )KutenRowCodeChartaV  Formats one 'row' of the 94x94 space used in many Asian encodings.aliases

These deliberately resemble the code charts in Ken Lunde's "Understanding
CJKV Information Processing", to enable manual checking.  Due to the large
numbers of characters, we don't try to make one graphic with 10,000 characters,
but rather output a sequence of these.c                   Wn         ^^V n        ^V n        ^V n        ^V n        . ROV n        ^ V n        W n        W0n         \        P                  ! V P                  V P                  4      p\        P                  ! V4       T P                  R,           T P                  ,           T n        T P                  4        R#    RT n        RT n         LM; i)^   rt   r   rZ   N)0020406080)r#   r   r   r   r   rG   r+   r[   r\   r   CIDFontr   r]   r:   r&   r"   r#   r[   r\   fonts   &&&& r%   r_   KutenRowCodeChart.__init__   s    	3 (	2##DMM43D3DED##D)
 +d.?.??	2'DM 1D    AB< <Cc                   . pV P                   P                  R4      R8  dP   \        ^^_4       F=  p\        V^,           4      \        V^,           4      ,           pVP	                  V4       K?  	  V# VP	                  R.^^,          4       V# )z1Works out the character values for this kuten rowEUCNr\   findr   r   r    )r"   r#   cellsr$   rA   s   &&   r%   makeRowKutenRowCodeChart.makeRow   sx    !!%(2-Q|cCi(8CG+<<R  $  LL$"%r(   c                   V P                  R V P                  ,          R7       R.V P                  V P                  4      ,           pV P                  V4       V P                  P                  V P                  V P                  4       R# )zR%drH   NrJ   r#   r   rB   r8   rp   r!   r   r"   r>   s   & r%   rr   KutenRowCodeChart.draw   sZ    !12 6DLL22x 		tzz4::.r(   
r   r   r   r\   r[   r:   r+   r#   rG   r   N
rM   rN   rO   rP   rQ   r_   r   rr   rR   rS   rT   s   @r%   ry   ry      s     ., 	/ 	/r(   ry   c                   6   a  ] tR t^t o RtR tR tR tRtV t	R# )Big5CodeChartzFormats one 'row' of the 94x160 space used in Big 5

These deliberately resemble the code charts in Ken Lunde's "Understanding
CJKV Information Processing", to enable manual checking.c                   Wn         ^V n        ^V n        ^V n        ^
V n        ^V n        W n        W0n        . ROV n         \        P                  ! V P                  V P                  4      p\        P                  ! V4       T P                  R,           T P                  ,           T n        T P                  4        R#    RT n        RT n         LM; i)   rt   r   rZ   N)
4567ABCDEF)r#   r   r   r   r   r+   r[   r\   rG   r   r   r   r]   r:   r&   r   s   &&&& r%   r_   Big5CodeChart.__init__   s    	 (B	2##DMM43D3DED##D)
 +d.?.??	2'DM 1Dr   c                .   . pV P                   P                  R4      R8  dZ   R FQ  p\        ^4       F?  pV^,          V,           p\        V4      \        V4      ,           pVP	                  V4       KA  	  KS  	  V# VP	                  R.^,          4       V# )zDWorks out the character values for this Big5 row.
Rows start at 0xA1B5Nr   )
            
            rv      r   )r"   r#   r   yxr$   rA   s   &&     r%   r   Big5CodeChart.makeRow  s     !!$'",0rAB$q&C!##6BLL$ # 1  LL$#&r(   c                   V P                  R V P                  ,          R7       V P                  V P                  4      pV P                  V4       V P                  P                  V P                  V P                  4       R# )r*   r   Nr   r   s   & r%   rr   Big5CodeChart.draw  sQ     12<<)x 		tzz4::.r(   r   Nr   rT   s   @r%   r   r      s     @* / /r(   r   c           	        VP                  4         \        P                  ! V4      pVP                  R4       VP                  W#\        P                  ! W^4      ^^ ^R7       VP                  ^ 4       VP                  V^^4       VP                  W#V 4       VP                  4        R#   \         d0    \        P
                  ! T4      p\        P                  ! T4        Li ; i)zHelper for stringwidth tests on Asian fonts.

Registers font if needed.  Then draws the string,
and a box around it derived from the stringWidth functionrE   r1   N)	saveStater   getFontKeyErrorr   UnicodeCIDFontr]   r;   r<   stringWidthr9   
drawStringrestoreState)msgcanvasr   r   r:   r   s   &&&&& r%   hBoxTextr     s    
 &!!(+
 s
KKJ**3"=bqKQ
q
NN8R#
a#
  &&&x0%&s   B, ,7C&%C&c                   0   a  ] tR tRt o RtR tR tRtV tR# )
CodeWidgeti1  z Block showing all the charactersc                >    ^ V n         ^ V n        ^V n        ^V n        R# )    N)r   r   r   r   )r"   s   &r%   r_   CodeWidget.__init__3  s    
r(   c                X   V P                   R ,          pV P                  R ,          p\        4       pVP                  \	        V P
                  V P                  V P                   V P                  R\        P                  R7      4       \        ^4       F  p\        ^4       F  pV^,          V,           pV^ 8  g   K  \        V P
                  WA,          ,           V P                  V P                  WR,          ,
          ,           \        V4      4      pVP                  V4       K  	  K  	  V# )g      0@N)	fillColorstrokeColor)r   r   r   addr   r   r   r
   blackr   r   r   )r"   dxdygr   r   	charValuess   &       r%   rr   CodeWidget.draw9  s    ZZ$[[4G	d4664664::t{{!v||= 	>rA2YFQJ	r>tvv#vvqt);<hy>QSAEE!H   r(   )r   r   r   r   N)	rM   rN   rO   rP   rQ   r_   rr   rR   rS   rT   s   @r%   r   r   1  s     * r(   r   c                  T   \        R 4      p V P                  R^4       V P                  ^HRR4       \        4       pVP	                  V ^HR4       \        ^ R7      pVP	                  V ^HR4       \        ^^ R7      pVP	                  V ^H^d4       V P                  4        \        R4       R	# )
zcodecharts.pdfzHelvetica-Boldi  zTesting code page chartsi  )r   i,  )r   r+   zsaved codecharts.pdfN)r   r9   r   rW   drawOnsaveprint)ccc1cc2cc3s       r%   testr   M  s     AII#LLS45
!
#CJJq"c
!b
1CJJq"c
!ba
8CJJq"c FFH	
 !r(   __main__)__version__rQ   rn   reportlab.pdfgen.canvasr   reportlab.platypusr   reportlab.pdfbaser   r   reportlab.graphics.shapesr   r   r   reportlab.graphics.widgetbaser	   reportlab.libr
   reportlab.lib.utilsr   rl   r   rW   ry   r   r   r   r   rM   re   r(   r%   <module>r      s   
 	9  * ' 2 9 9 0   ( izX	d*H d*L)/m )/X8/ 8/v//M //d( 8": ZF r(   