mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
Expand -thinlines to allow thinning as well of thickening
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
%Document negative widths in -thinlines
|
||||||
%\DocumentMetadata{lang=en, pdfversion=2.0, pdfstandard=ua-2, pdfstandard=a-4f, testphase={phase-III, title, table, math, firstaid}}
|
%\DocumentMetadata{lang=en, pdfversion=2.0, pdfstandard=ua-2, pdfstandard=a-4f, testphase={phase-III, title, table, math, firstaid}}
|
||||||
\documentclass{book}
|
\documentclass{book}
|
||||||
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
|
||||||
|
@ -146,6 +146,7 @@ let blackfills c range pdf =
|
|||||||
|
|
||||||
(* Set a minimum line width to avoid dropout *)
|
(* Set a minimum line width to avoid dropout *)
|
||||||
let thinlines range width pdf =
|
let thinlines range width pdf =
|
||||||
|
let comparison, width = if width < 0. then ( <= ), ~-.width else ( >= ), width in
|
||||||
let thinpage _ page =
|
let thinpage _ page =
|
||||||
let operators =
|
let operators =
|
||||||
Pdfops.parse_operators pdf page.Pdfpage.resources page.Pdfpage.content
|
Pdfops.parse_operators pdf page.Pdfpage.resources page.Pdfpage.content
|
||||||
@ -165,7 +166,7 @@ let thinlines range width pdf =
|
|||||||
(* Alter width. *)
|
(* Alter width. *)
|
||||||
let width' = width /. scaleof_ctm () in
|
let width' = width /. scaleof_ctm () in
|
||||||
let w' =
|
let w' =
|
||||||
if w >= width' then Pdfops.Op_w w else Pdfops.Op_w width'
|
if comparison w width' then Pdfops.Op_w w else Pdfops.Op_w width'
|
||||||
in
|
in
|
||||||
replace_operators (w'::prev) more
|
replace_operators (w'::prev) more
|
||||||
| (Pdfops.Op_cm m)::more ->
|
| (Pdfops.Op_cm m)::more ->
|
||||||
@ -212,7 +213,7 @@ let thinlines range width pdf =
|
|||||||
let operators = replace_operators [] operators in
|
let operators = replace_operators [] operators in
|
||||||
(* 2. Add an initial 'w' if width more than default width *)
|
(* 2. Add an initial 'w' if width more than default width *)
|
||||||
let operators =
|
let operators =
|
||||||
if width > 1. then (Pdfops.Op_w width)::operators else operators
|
if width > 1. || width < 1. then (Pdfops.Op_w width)::operators else operators
|
||||||
in
|
in
|
||||||
let content' = [Pdfops.stream_of_ops operators] in
|
let content' = [Pdfops.stream_of_ops operators] in
|
||||||
{page with Pdfpage.content = content'}
|
{page with Pdfpage.content = content'}
|
||||||
|
Reference in New Issue
Block a user