summaryrefslogtreecommitdiff
path: root/pcl/pl
Commit message (Collapse)AuthorAgeFilesLines
* Update postal address in file headersChris Liddell2023-04-0452-160/+164
|
* Debugging fixupsHenry Stiles2023-02-281-1/+4
| | | | | A character array was accessed incorrectly and we now include a complete dump of downloaded fonts with the font debugging option '='.
* Tweak parameter testing to use an 'argis' macro.Robin Watts2023-02-281-47/+39
| | | | | | | | | | | | | | | | | | At various places in the code, we test for parameters from a param_list by using: if (!strncmp(param, "ParamValue", strlen("ParamValue")) This is bad, because as well as matching "ParamValue" and "ParamValue=", it will also match "ParamValueSomething". Also, at various places in the code, we don't call strlen (understandably, cos that's a runtime function call to retrieve a constant value), and just wire in the constant value. But in at least 1 location, we've got the constant value wrong. Accordingly, move to using an 'argis' macro that tests correctly and calculates the length at compile time.
* Avoid GPDL 'pass_param_to_languages' early termination.Robin Watts2023-02-281-1/+1
| | | | | | | Only stop passing params to languages on an error, not on a non-zero return code. This was causing arguments not to make it to SO for processing.
* Bug 706389: Fix versioning format consistencyChris Liddell2023-02-271-3/+1
| | | | | | | | | | | | | The main code issue with this bug was that the banner printed on startup is printed from Postscript, and Postscript's cvs operator doesn't allow for dictating the number of digits it outputs so the number 00 will always end up as the string "0", or 01 as "1". So our 10.01.0 version would be printed as "10.1.0". To address this, as a ".revisionstring" entry to systemdict, created during startup, the string is created in C, so we control the format. The remaining issues need to be address as part of the release process.
* Fix another memory leak of param lists in gpdl.Robin Watts2023-02-221-1/+2
| | | | This is seen when we exit an instance with an error.
* Fix windows builds of gpdl, broken by utf8 change.Robin Watts2022-11-221-1/+1
| | | | | I missed a rename of gp_wutf8.c to gp_utf8.c in one of the many makefiles.
* Move gp_wutf8 functions to be gp_utf8.Robin Watts2022-11-211-3/+3
| | | | | | Promote previously windows specific functions to be generically available (and give them names that reflect that).
* Allow @file syntax to include files in the ROM file systemKen Sharp2022-11-214-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This started as a customer request, where the customer wanted to store a file in the ROM file system with a bunch of command line parameters in it, and then use the @file syntax to run that file and setup the interpreter. In essence a 'canned' setup stored in the ROM file system. That didn't work, at all, because of a dichotomy in the logic of argument processing. The code used 'lib_file_open' in order to find the file using the search path which, on Ghostscript, includes all the iodevices, Rom file system, RAM file system etc. That function returns a stream which the calling function 'lib_fopen' would then reach inside and pull out the pointer to the underlying gp__file *, and return, because the argument processing was written to use a gp_file *, not a stream *. But.... For the ROM file system, what we store in the 'file' member of the stream is not a gp_file *, its a 'node' *. Trying to use that as a gp_file * rapidly leads to a seg fault. So this commit reworks the argument processing to use a stream * instead of a gp_file *. In reality there is no real difference to the logic we simply use a different call. There are a lot of fiddly references to change unfortunately. There are some consequences; we need to pass stream * around instead of gp_file *, and in particular the 'encoding' functions, which are OS-specific need to use a stream *. This isn't a problem for the interpreters and graphics library, but mkromfs *also* uses those OS-specific files, and it does not have the stream library available. Rather than trying to include it, we note that we don't actually need to use these functions for mkromfs and we do the same hackery as for other missing functionality; we define a stub function that does nothing but will permit the compile to complete.
* Add text file interpreter for gpdl.Robin Watts2022-10-211-0/+5
| | | | | | | Spots ascii/utf8/utf16 and feeds to PCL interpreter. May need further tweaking with both text file spotting and font selection, but it's a decent start.
* Revise FAPI integration in PCL code.Chris Liddell2022-10-122-5/+3
| | | | | | | | | | | | | Originally, the FAPI code held a buffer of the full font data, for the duration of the life of the font object. Given that the entire font set is memory resident, three times over, for the life of the interpreter(s), that ends up holding quite a lot of memory. This changes it so it uses the font data read directly from the romfs (rather than read into a persistent memory buffer). To maintain performance, we now store the PCL fonts uncompressed in the romfs. This grows the binary from 25Mb to 29Mb.
* PCL interpreter - fix decode_glyph for UnicodeKen Sharp2022-09-271-3/+9
| | | | | | | | | | | | | | | | | | | | The text extraction (and pdfwrite family) expect that decode_glyph should always return pairs of bytes (an assumption that Unicode code points are 2 bytes), and the return value from the routine should be the number of bytes required to hold the value. The PCL decode_glyph routine however was simply returning 1, which caused the text extraction code some difficulty since it wasn't expecting that. This commit firstly alters the text extraction code to cope 'better' with a decode_glyph routine which returns an odd value (basically ignore it and fall back to using the character code). We also alter the pl_decode_glyph routine to return 2 instead of 1, so that it correctly tells the caller that it is returning 2 bytes. Finally we make sure that the returned value is big-endian, because the text extraction code assumes it will be.
* Correct PCL passthrough SEGVs.Robin Watts2022-09-201-1/+1
| | | | | | | | | | | | | | In commit 90fa745b7 (Add gpdl support for SmartOffice integration), I tweaked the way we found the PCL interpreter, so that instead of relying on it being at a fixed point in the list of interpreters, we hunted for it by name. And then I used the wrong name. Use the right name instead. I am at a loss to understand why the normal cluster tests didn't pick this up.
* Add gpdl support for SmartOffice integration.Robin Watts2022-09-193-14/+52
| | | | | No actual SmartOffice code here, just the framework for adding the (private) "SO" interpreter.
* gpdl: Ensure that -o sets -dNOPAUSE for postscript jobs.Robin Watts2022-09-161-3/+5
| | | | | Postscript jobs require NOPAUSE in the dict, not just in the main instance.
* Change how pdfi interacts with FAPI for Truetype fontsChris Liddell2022-07-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In PDF, only symbolic Truetype fonts draw marks from the glyph at GID zero (the TTF notdef). But the default TTF notdef is an empty rectangle, rather than the Postscript style non-marking glyph. The FAPI/Freetype incremental interface integration includes code to spot that case, and return an empty glyph. Since PDFs don't do incremental font definitions, the pdfi code simply passed the TTF into FAPI, and onto Freetype as a complete font, so all the glyph lookups were handled inside Freetype, not using the incremental interface. Thus we lost the ability to do that "filtering". Equally, we don't want to take the time to break down the font and "reassemble" it as the Postscript interpreter is forced to do. This implements a hybrid approach where we still pass the font data unchanged into Freetype, but we still use the incremental interface, allowing that notdef filtering to happen. This commit affects a heuristic in freetype which autmatically enables autohinting, meaning we'll no longer get autohinting in cases where we previously did. That gives a perceived drop in quality at low resolutions. Since autohinting can be enabled at the command line, it's not a serious concern.
* Support -dNODISPLAY command line option in "pl" layerChris Liddell2022-03-181-19/+23
| | | | | | | | | | Ghostscript has "-dNODISPLAY" which is a shortcut option for: "-sDEVICE=nullpage -dBATCH -dNOPAUSE" add support for that to the "pl" layer, so other languages handle it, too. Prompted by the fix for bug 705075.
* Coverity 375566: Init ref counting entry for gs_halftone (xps)Chris Liddell2022-02-171-1/+2
| | | | | | | | | | | | | | For the stack based halftone, we want to set the reference counting data to zeros/NULLs - in this case, it is later copied into an actually reference counted, heap allocated object. Equivalent to 6849cc4774817a2afa2e6f4d77c1aa63e432352f in pdf/ Coverity 375605: Init ref counting entry for gs_halftone For the stack based halftone, we want to set the reference counting data to zeros/NULLs - in this case, it is later copied into an actually reference counted, heap allocated object.
* Squash a compiler warning with debug build.Chris Liddell2022-02-171-1/+1
|
* Coverity 375727: initialise stack variableChris Liddell2022-02-171-2/+3
| | | | | In the case where it matters, we wouldn't hit it without being initialised, but Coverity can't know that, and the cost to initialise it is tiny.
* Move pcl/ sources away from gs_sprintf to gs_snprintfChris Liddell2022-02-162-3/+3
|
* Fix memory leak.Robin Watts2022-02-031-2/+2
| | | | | | | | | | | | | | When running a windows memento, 32bit build of: gpcl6 -dNOPAUSE -dBATCH -sDEVICE=ppmraw -dMaxBitmap=1000 -r300 -o gpcl6.out ../tests_private/pcl/pcl5cats/*.BIN we'd see leaks from pl_bitmap_build_char. I could not reproduce these when running individual files. A desk-check of the code spotted that penum would not be freed if a particular error path was taken. Fixing that (as here), removes the leaks.
* Bug 693376: Move pjl_permanent_soft_fonts to pjl state structure.Robin Watts2022-01-211-12/+12
| | | | | Move a global to the pjl state. The global is initialised when the pjl state is allocated, so the lifespans match.
* Add pdfi to gpdlChris Liddell2021-12-071-3/+3
| | | | | Means extending the pdf_detect_language() to check the first five (rather than two) bytes in the input.
* Fix for setting of PageSpotColors Bug 704660Michael Vrhel2021-11-051-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | plmain.c should not be setting the PageSpotColors value. This should be set by the individual interpreters on a per page basis. This change fixes a crash (Bug 704660) reduces the number of closing and opening times of the device with pdfi and pdfi renders more than 4 spots to the separation devices just fine. Also for gpdl with HEAD, the subsequent execution of a PS file following a PCL file did not properly reset the PageSpotColors to -1 as is required for PS files, resulting in improper output when going to a separation device. This commit includes a fix for that. Tested with command line gpdl -sDEVICE=psdcmyk -r72 -o ./myoutputs/pdl_input_%d.psd ./myinputs/owl.pcl ./myinputs/Ad_InDesign.ps ./myinputs/spots_multi_page.pdf ./myinputs/input.xps ./myinputs/deviceNImage.eps ./myinputs/DeviceN_20Colors.pdf ./myinputs/page_spots/Ad_InDesign.ps to verify that the number of spots was getting properly set with each interpreter and page (when applicable) change.
* Runtime safety of non threadsafe devices and rework globals.Robin Watts2021-11-051-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices within Ghostscript (currently the x11 devices, uniprint and opvp/oprp) use non const static variables, so cannot be run in multiple instances at a time. We now maintain a core "count" of how many non-threadsafe devices are being used at any time. This value can be atomically adjusted by calls to gs_lib_ctx_nts_adjust. Non threadsafe devices now call gx_init_non_threadsafe_device either as or as part of their initialise_device proc. This function attempts to increment the non-threadsafe count and fails to init if there is already a non-threadsafe device running. On success, the device finalize method is modified so that it will decrement the count at the end. The known non-threadsafe devices are updated to call this. In order to have somewhere safe to store this count, we introduce a gs_globals structure, shared between instances. Setting this up without race conditions requires some new gp_ functions that can make use of platform specific threading primitives. We have these implemented for both windows and pthread based platforms. On other platforms, we drop back to the old unsafe mechanism for counting instances. While we do this work, we take the opportunity to push the gs_memory_t pointer used for non-threadsafe debug printing into thread local storage. This enables us to remove the remaining GS_THREADSAFE guarded compilation from the source code. What is left is broadly down to allowing debugging collection for statistics, and these are now controlled by specific COLLECT_STATS_XXX defines. It is assumed that anyone wanting to collect such stats is smart enough to not try to do so while using Ghostscript in a multi-instance environment.
* Bug 704255: Fix bounds checking of fco file name stringChris Liddell2021-08-271-2/+3
| | | | | | | | | | | When UFST is in use, the build creates a string containing a list of the accessible FCOs (separated by "gp_file_name_list_separator" characters) which we loop over, enumerating the fonts available in each. The bounds checking of that string was just incorrect. Thanks to Norbert for pointing out the problem, and suggesting part of the fix.
* Remove redundant entries from pl_interp_characteristics_tChris Liddell2021-08-254-21/+7
| | | | | | | | | The manufacturer, version and build date entries in the pl_interp_characteristics_t were never really used except for version, which was just set to the GS_VERSION. Remove the pointless entries, and use a more direct approach to version reporting.
* PCL: Update windows call sequence to match linux.Robin Watts2021-08-201-0/+12
| | | | | | | | | | | Linux sends a UEL at the end of a job, windows does not. This causes files that end in (for example): <UEL>@PJL LPORTROTATE (with no trailing return) to give an error. Windows and linux now behave the same.
* Fix wrong length parameter.Henry Stiles2021-08-161-3/+3
| | | | | Norbert Janssen spotted this regression with fixing 703885, see comment #14 in the bug.
* Coverity ID: 372274Chris Liddell2021-08-131-1/+1
| | | | | | | Explicitly ignore return value from gs_purge_font() As things stand, it shouldn't ever return an error, and there is nothing we can do differently in the event of an error.
* Commit pdfi to master.Robin Watts2021-08-124-2/+15
| | | | | | | | | | | This is a commit of the pdfi branch to master, eliminating the traditional merge step. The full history of the pdfi branch can be seen in the repo, and that branch is effectively frozen from this point onwards. This commit actually differs from pdfi in a small number of whitespace changes (trailing spaces etc).
* Add -dRESETRESOURCES option for gpdl.Robin Watts2021-08-104-3/+71
| | | | | | | | | | | | | | | | | | In this instance 'RESOURCES' means fonts, macros, symbol sets etc. This applies to PCL (and maybe others), but not Postscript resources. Default (and setting this to 0) gives the behaviour where resources are never reset based upon job language changes. Setting this to 1 causes resources to be reset between jobs (whenever we return to PJL). Setting this to 2 causes resources to be reset whenever we "change language". For this setting, we do not count returning to PJL and reentering the same language as being a language change. (Includes fixes and code from Henry Stiles).
* Tweak param name in pl_auto_sense.Robin Watts2021-08-101-3/+3
| | | | | | The param points to a buffer of data for a language to attempt to auto detect data, not the name of a language. Correct the naming to be less confusing.
* Rejig text_begin dev_proc.Robin Watts2021-06-151-1/+1
| | | | | | | | | | | | | | | | | | | In this commit we remove several parameters to the text_begin device procedure, because they are implied. Firstly, we remove pdcolor, and just use the device color from the current color in the graphics state (pgs->color[0]). This is actually what the code did anyway (in that it was assumed that pdcolor, if it was non-NULL was a pointer to this). Similarly, we remove the path param, as (if used) this is always the same as pgs->path. Finally, we remove the memory param as this is (almost always) the same as pgs->memory (and in cases where it isn't, tests indicate that it could be). This has knock on effects for the text enumerator structure.
* Add object type specific device halftones to the graphics state.Ray Johnston2021-05-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | PostScript 'sethalftone' has an optional parameter "ObjectType" that allows one of the three object specific types to be set: Vector, Image or Text. Also add a new PostScript operator to set the current halftone (dev_ht, set by sethalftone) as the device halftone to be used for an object type: path, image and text. For non-PostScript clients, the gs_halftone structure adds a 'objtype' element (enum) that can be set prior to calling gs_sethalftone. The gs_gstate_s dev_ht is now an array of HT_OBJTYPE_COUNT elements, indexed by the gs_HT_objtype_t enum, with HT_OBJTYPE_DEFAULT (value 0) used for prior sethalftone/setscreen/setcolorscreen operations. NOTE: adding object types beyond the default+3 entries will require modification of gx_select_dev_ht since it only uses 3 bits of the 'tag' to get the index for the dev_ht[] array. For code style, change to use != NULL instead of != 0 in most places that this commit touched (but we may want a general cleanup of this everywhere). TBD: Command line options for all PDL's will need a method to take a halftone specification -- most likely a file that may be "PS-lite" syntax and may be limited to a threshold array. Discussions are in progress.
* Suppress PJL build date in CLUSTER builds.Robin Watts2021-04-231-0/+4
| | | | | The build date is printed in the (expected) error output that we test for in runtests builds, resulting in diffs.
* Update copyright to 2021Chris Liddell2021-03-1552-52/+52
|
* Fix exports for GPL DLL.Robin Watts2021-03-111-2/+4
| | | | This was preventing api_test working on windows.
* Bug 703294: Fix Ghostscript build for AndroidPeter Cherepanov2021-02-152-2/+3
| | | | | | | Header files shifted around so that the redefinition of printf happens after cdefs. Also removes redundant CONTDEVH definition from contrib/contrib.mak
* "Address" subscript -1 is outside array bounds warningChris Liddell2020-10-061-8/+4
| | | | | | | | | | | | | | | | | There is no immediate prospect of resolving the underlying issue: that the stream code requires the data pointer in the "cursor" to be initialised to the address one byte *before* the beginning of the actual buffer. We also do not want to disable the array bounds warning completely, as that risks missing real mistakes. So, define a static inline function which does the offending pointer assignment, and disable the warning locally, for only that function. Then have everywhere that uses such a buffer setup call that function, rather than do the assignment itself. At the moment, it is only disabled for gcc (and compatible) compilers, we can add others if/as required.
* Squash a couple of compiler warnings.Robin Watts2020-10-011-1/+0
|
* Fix memory leak in pcl pdfmark implementationNancy Durgin2020-09-221-0/+3
| | | | | | | The memory allocated by param_write_string_array() was never being released. (Note: the cluster doesn't test this code path currently)
* Fix segfaults in UFST - use correct font nameChris Liddell2020-09-211-1/+1
| | | | Omission from commit: a10a03a4c9713b38c4cfcd07f0ba3c722778aae0
* Strip trailing whitespace from makefiles.Robin Watts2020-09-091-5/+5
|
* Strip trailing whitespace from .c and .h files.Robin Watts2020-09-092-2/+2
|
* Rejig PCL/PXL to call graphics library rather than device functions.Robin Watts2020-09-084-153/+24
| | | | | | | | Also remove pl_begin_image2/pl_image_data2/pl_end_image2 etc functions - might as well just call direct. This leaves pldraw.c and pldraw.h empty, so remove them. Also, take the opportunity to fix some potential cleanup problems.
* Bug 702744: Add windows utf-8 handling for unlink and rename.Robin Watts2020-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | To do this, we introduce gp_unlink and gp_rename, and call those as appropriate. Also, make gp_open_scratch_file add the file to the permit list. When such a file is closed, it will be deleted from the permit list. It will also be removed from the permit list if the file is deleted using the PS deletefile operator. On closedown, if scratch files haven't been deleted, then we'll delete them as part of the closedown of gs_lib_ctx. This means that 'purging' the control lists must not remove scratch file paths from the list. Also, ensure that gsapi callers can't maliciously (or accidentally) remove scratch path paths from the list so as to leave them around after closedown.
* Update gsapi_set_params to use an "int *" for booleans.Robin Watts2020-08-143-7/+5
|
* Swap order of arguments in gsapi_set_param/gsapi_get_param.Robin Watts2020-08-112-4/+4
| | | | This should play nicer with python.