@@ -31,7 +31,7 @@ static char *PSL_label_str =
31
31
"%- out where labels are placed and setting clip paths etc.\n"
32
32
"%-\n"
33
33
"%- NOTE: No longer used as replaced by static string in PSL_strings.h.\n"
34
- "%- We keep the file in the repository as it may be simpler to see\n"
34
+ "%- We keep the file in the repository as it may be simpler to see and edit \n"
35
35
"%- the logic in this file than in the static string.\n"
36
36
"%-----------------------------------------------------------------------------\n"
37
37
"\n"
@@ -672,33 +672,34 @@ static char *PSL_label_str =
672
672
static char * PSL_text_str =
673
673
"%-----------------------------------------------------------------------------\n"
674
674
"%- P. Wessel, version 1\n"
675
- "%- Text justification for paragraphs.\n"
676
- "%- Kept as separate file until stable .\n"
675
+ "%- Text justification for paragraphs. Invented via PostScript docs a long time ago. \n"
676
+ "%- Kept as separate file because it is easier to edit and see the logic here .\n"
677
677
"%- Knows about flush l,c,r and justified.\n"
678
- "%- Knows about all GMT @ escapes, composites, \n"
678
+ "%- Knows about all GMT @ escapes, composites (but not in paragraph mode) \n"
679
679
"%- and underlining. No hyphenation. 1 page only.\n"
680
- "%- NOTE: No longer used as replaced by static string in PSL_strings.h.\n"
681
- "%- We keep the file in the repository as it may be simpler to see\n"
680
+ "%- NOTE: No longer used as is, as replaced by static string in PSL_strings.h.\n"
681
+ "%- We keep the file in the repository as it may be simpler to edit and see\n"
682
682
"%- the logic in this file than in the static string.\n"
683
683
"%-----------------------------------------------------------------------------\n"
684
684
"\n"
685
- "/PSL_setfont { % Set Font, size, and color if needed\n"
685
+ "/PSL_setfont { % Set Font, size, and color (if needed)\n"
686
+ " % Expects two arguments: Word flag and word index\n"
686
687
" /f exch def % Gets word flag from stack\n"
687
688
" /k1 exch def % Gets word index from stack\n"
688
689
" /fz PSL_size k1 get def % Get font size\n"
689
- " /fn PSL_fnt k1 get def % Get font\n"
690
- " fn PSL_lastfn eq fz PSL_lastfz eq and not {\n"
690
+ " /fn PSL_fnt k1 get def % Get font number \n"
691
+ " fn PSL_lastfn eq fz PSL_lastfz eq and not { % If fonts or sizes differ we must update \n"
691
692
" fz PSL_fontname fn get Y % Set font and size\n"
692
693
" /PSL_lastfn fn def\n"
693
694
" /PSL_lastfz fz def\n"
694
695
" } if\n"
695
- " /fc PSL_color k1 get def\n"
696
- " fc PSL_lastfc ne {\n"
696
+ " /fc PSL_color k1 get def % Get color \n"
697
+ " fc PSL_lastfc ne { % Not the same, must update color \n"
697
698
" /PSL_c fc 3 mul def\n"
698
699
" 0 1 2 {PSL_c add PSL_rgb exch get} for C % Get and set color\n"
699
700
" /PSL_lastfc fc def\n"
700
701
" } if\n"
701
- " f 32 and 32 eq { % Underline \n"
702
+ " f 32 and 32 eq { % Turn underline on before plotting text \n"
702
703
" /PSL_UL fz 0.075 mul def\n"
703
704
" fz 0.025 mul W\n"
704
705
" /PSL_show {PSL_ushow} def\n"
@@ -709,24 +710,25 @@ static char *PSL_text_str =
709
710
"}!\n"
710
711
"\n"
711
712
"/PSL_setfont2 { % Only set font and size\n"
713
+ " % Expects two arguments: Word flag and word index\n"
712
714
" /f exch def % Gets word flag from stack\n"
713
715
" /k1 exch def % Gets word index from stack\n"
714
716
" /fz PSL_size k1 get def % Get font size\n"
715
- " /fn PSL_fnt k1 get def % Get font\n"
717
+ " /fn PSL_fnt k1 get def % Get font number \n"
716
718
" fn PSL_lastfn eq fz PSL_lastfz eq and not {\n"
717
719
" fz PSL_fontname fn get Y % Set font and size\n"
718
720
" /PSL_lastfn fn def\n"
719
721
" /PSL_lastfz fz def\n"
720
722
" } if\n"
721
723
"}!\n"
722
724
"\n"
723
- "/PSL_wordheight { % Gets word from stack, and calculates any adjustment to box height\n"
725
+ "/PSL_wordheight { % Gets word from stack, then calculates any adjustment to box height\n"
724
726
" 0 0 M false charpath flattenpath pathbbox /up exch def pop /down exch def pop newpath\n"
725
727
" down PSL_ymin lt {/PSL_ymin down def} if\n"
726
728
" up PSL_ymax gt {/PSL_ymax up def} if\n"
727
729
"}!\n"
728
730
"\n"
729
- "/PSL_ushow {\n"
731
+ "/PSL_ushow { % Related to underline showing text \n"
730
732
" currentpoint /y0 exch def /x0 exch def\n"
731
733
" ashow\n"
732
734
" currentpoint pop /x1 exch def\n"
@@ -737,24 +739,25 @@ static char *PSL_text_str =
737
739
"% Set font, size, and color. Adjust baseline if needed. Place space and word\n"
738
740
"\n"
739
741
"/PSL_placeword {\n"
740
- " /k exch def % Gets word index from stack\n"
742
+ " % Expects one argument: the word index from stack\n"
743
+ " /k exch def % Gets word index\n"
741
744
" /flag PSL_flag k get def\n"
742
745
" k flag PSL_setfont\n"
743
746
" /sshow {ashow} def\n"
744
- " PSL_col 0 eq { % First word on a line\n"
747
+ " PSL_col 0 eq { % First word on a new line\n"
745
748
" /PSL_t 0 def % 0 spaces before this word\n"
746
- " flag 4 and 4 eq { % Must skip one TAB\n"
749
+ " flag 4 and 4 eq { % Flag says we must skip one TAB (here 4 spaces) \n"
747
750
" pr_char 0 ( ) ashow\n"
748
751
" } if\n"
749
752
" }\n"
750
- " { % Need to find spaces before this word\n"
751
- " /f PSL_flag k 1 sub get def % f is flag for previous word\n"
753
+ " { % Need to find spaces before this word\n"
754
+ " /f PSL_flag k 1 sub get def % f is the flag for previous word\n"
752
755
" /PSL_t f 3 and def % PSL_t is index into PSL_spaces and PSL_spacewidths for previous word\n"
753
756
" f 32 and 32 eq flag 32 and 32 eq and {/sshow {PSL_ushow} def} if\n"
754
757
" } ifelse\n"
755
758
" /thisword_bshift PSL_bshift k get def % The baseline shift\n"
756
759
" thisword_bshift 0.0 ne {0 thisword_bshift G} if % Shift baseline\n"
757
- " flag 8 and 8 eq { % First composite char\n"
760
+ " flag 8 and 8 eq { % First composite char (flagged with 8) \n"
758
761
" pr_char 0 PSL_spaces PSL_t get sshow\n"
759
762
" k PSL_composite\n"
760
763
" } if\n"
@@ -766,18 +769,19 @@ static char *PSL_text_str =
766
769
"}!\n"
767
770
"\n"
768
771
"/PSL_composite { % Place a composite character\n"
772
+ " % Expects a word index from the stack\n"
769
773
" /k1 exch def % Get word index from stack\n"
770
- " /k2 k1 1 add def\n"
771
- " /char1 PSL_word k1 get def\n"
772
- " /char2 PSL_word k2 get def\n"
773
- " /flag2 PSL_flag k2 get def\n"
774
- " /w1 char1 stringwidth pop def\n"
775
- " flag2 64 and 64 eq { % We have a font change before the 2nd composite character\n"
774
+ " /k2 k1 1 add def % Index to the 2nd composite character \n"
775
+ " /char1 PSL_word k1 get def % First character \n"
776
+ " /char2 PSL_word k2 get def % Second character \n"
777
+ " /flag2 PSL_flag k2 get def % Second character flag \n"
778
+ " /w1 char1 stringwidth pop def % Width of first character \n"
779
+ " flag2 64 and 64 eq { % Here, 64 means we have a font change before the 2nd composite character\n"
776
780
" /fn2 PSL_fnt k2 get def % Get the other font array number\n"
777
781
" fz PSL_fontname fn2 get Y % Set font and size for the 2nd composite character\n"
778
782
" } if\n"
779
- " /w2 char2 stringwidth pop def\n"
780
- " /delta w1 w2 sub 2 div PSL_scale mul def\n"
783
+ " /w2 char2 stringwidth pop def % Width of second character \n"
784
+ " /delta w1 w2 sub 2 div PSL_scale mul def % Adjust and center based on w1, w2 \n"
781
785
" delta 0.0 gt {\n"
782
786
" /dx1 0 def\n"
783
787
" /dx2 delta def\n"
@@ -787,7 +791,7 @@ static char *PSL_text_str =
787
791
" /dx2 0 def\n"
788
792
" } ifelse\n"
789
793
" dx1 0 G currentpoint\n"
790
- " flag2 64 and 64 eq { % Must switch back to 1st composite character font and set it\n"
794
+ " flag2 64 and 64 eq { % Must switch back to first composite character font and set it\n"
791
795
" /fn1 PSL_fnt k1 get def % Get initial font\n"
792
796
" fz PSL_fontname fn1 get Y % Set font and size\n"
793
797
" } if\n"
@@ -815,7 +819,7 @@ static char *PSL_text_str =
815
819
" /PSL_col 0 def\n"
816
820
"}!\n"
817
821
"\n"
818
- "% Calculate text paragraph height:\n"
822
+ "% Calculate text paragraph height or place it :\n"
819
823
"\n"
820
824
"/PSL_textjustifier {\n"
821
825
" /PSL_mode exch def % From stack. 0 -> calculate height, no text is placed, 1 -> place text\n"
@@ -836,14 +840,14 @@ static char *PSL_text_str =
836
840
" /line 0 def\n"
837
841
" /ncomp 0 def\n"
838
842
" /comp_width 0 def\n"
839
- " 0 1 PSL_n1 { % Loop over all the words\n"
843
+ " 0 1 PSL_n1 { % Loop over all the words in the array \n"
840
844
" /i exch def % The current loop index\n"
841
- " /thisflag PSL_flag i get def % # of space chars to follow this word\n"
842
- " i 0 eq {\n"
845
+ " /thisflag PSL_flag i get def % Number of space chars to follow this word\n"
846
+ " i 0 eq { % At the first word \n"
843
847
" /PSL_t 0 def\n"
844
848
" /lastflag 0 def\n"
845
849
" }\n"
846
- " { /lastflag PSL_flag i 1 sub get def\n"
850
+ " { /lastflag PSL_flag i 1 sub get def % Can get the previous flag \n"
847
851
" /PSL_t lastflag 3 and def\n"
848
852
" } ifelse\n"
849
853
" % PSL_t is index into PSL_spaces and PSL_spacewidths\n"
@@ -877,9 +881,9 @@ static char *PSL_text_str =
877
881
" }\n"
878
882
" { % Must process current line and move to next\n"
879
883
" 1 PSL_mode eq { % Write out the first word on this line\n"
880
- " % Determine how much to expand text and also justify left/center/right\n"
884
+ " % Determine how much to expand text and also justify left/center/right\n"
881
885
" start PSL_expand\n"
882
- " start PSL_placeword\n"
886
+ " start PSL_placeword\n"
883
887
" }\n"
884
888
" {PSL_word start get PSL_wordheight\n"
885
889
" } ifelse\n"
@@ -932,7 +936,7 @@ static char *PSL_text_str =
932
936
static char * PSL_prologue_str =
933
937
"%-----------------------------------------------------------------------------\n"
934
938
"%- NOTE: No longer used as replaced by static string in PSL_strings.h.\n"
935
- "%- We keep the file in the repository as it may be simpler to see\n"
939
+ "%- We keep the file in the repository as it may be simpler to see and edit \n"
936
940
"%- the logic in this file than in the static string.\n"
937
941
"%-----------------------------------------------------------------------------\n"
938
942
"% Begin pslib header\n"
0 commit comments