| Age | Commit message (Collapse) | Author |
|
Add gamma correction options for better contrast control in midnight mode:
- pdf-view-midnight-gamma: nonlinearly scale lightness (default 1.0)
- pdf-view-midnight-gamma-before-invert: control gamma application order
Bug fixes:
- Fix RGB normalization (255 not 256) - was causing incorrect background color
- Add missing black→foreground fast path (comment existed but code was missing)
Closes: #329
Author: @vizziv
|
|
Use platform-appropriate temp file creation:
- _tempnam() on Windows (Microsoft-recommended)
- mkstemp() on Unix-like systems
Fixes #110, addresses #316
Supersedes #235
|
|
This allows calling `pdf-info-addannot` from Lisp with a nil
`markup-edges` argument, which was previously disallowed.
In this case, the annotation covers exactly the selected region of the
page, without attempting to match it to a certain text region.
This means that you can now highlight an exact region! Just select the
region by holding down the Meta key and dragging the mouse. Then
invoke `pdf-annot-add-highlight-markup-annotation` (with `C-c C-a h`)
and voila!
Closes: #191
|
|
From the comments in the PR, @smithzvk explains the changes:
> I was bugged that it didn't pick up the hue from the background,
> however, so I made the all color a/b parameters start from the a/b
> parameters of the BG color. This makes the PDF background (white)
> map to your BG color and PDF foreground (black) map to your FG
> color, which can be set to your theme background making it seem
> pretty seamless. Note that if you set your BG and FG to a color
> theme without zero saturation (a gray tone of some sort), then you
> recover the original behavior.
>
> I also reinstated the cached transforms for background and the last
> color computed.
>
> I also refactored the loop to move the switch statement outside of
> the loop. It is more repetitive, but it was needed to get rid of
> some warnings about potentially uninitialized variables. It should
> also be faster as the branch was removed from the loop.
>
> I also ditched the gamma correction as it seemed to be doing the
> wrong thing and I never had a theoretical reasoning for it. I can
> get similar results if I just set my BG color to something like
> gray5 instead of black. Barely a difference in background but the
> hinting on the fonts is showing again. The root of my issue may
> have always been some kind of display calibration issue.
Closes: #197
|
|
Uses the Lightness values from the `pdf-view-midnight-colors` `fg` and
`bg` to scale the inverted color's lightness. Band-aid till better
method is found.
Relates to: #69
|
|
This inversion method attempts to maintain the color hue and saturation but
inverts the lightness using the OKLab color space[^1].
[^1]: https://bottosson.github.io/posts/oklab/
* server/epdfinfo.c (image-recolor): Add feature to support the OKLab
inversion method functionality
* lisp/pdf-view.el (pdf-view-midnight-invert): Add new variable to
invert the image color lightness while maintaining hue.
(pdf-view-midnight-minor-mode): Account for above.
* lisp/pdf-info.el (pdf-info-query--parse-response): Handle changes to
:render/usecolors command
Closes: #69
Closes: #169
Closes: politza/pdf-tools#698
Closes: politza/pdf-tools#608
|
|
Make selection-style configurable via `pdf-view-selection-style`. A
default value of `word` might be desirable, as selection is usually
intended to select entire words is perceptually faster than
glyph-based selection.
This affects selections and highlights, but not search.
Limitation:
The selection type is fixed for all currently selected regions.
Selecting multiple regions with different selection styles at the same
time would require storing the selection style for every region and
replacing the protocol for `cmd_addannot` with a more flexible one,
e.g. the keyword-based one used by `cmd_renderpage`.
Closes: #73
|
|
|
|
This reverts commit 0107f80dcf268d08ac075b01729820062c0fbd67
The reason for doing this is explained by @vizs in #143, copying the
message here:
Andreas wrote the function
`annotation_translate_quadrilateral`[^1][^2] to fix misplaced
annotations due to the then bug in `glib`. This misplacement bug can
be seen in the images posted in issue politza/pdf-tools#577, along
with PDFs in which the bug can be reproduced.
This lack of translation in the `glib` backend was fixed in `poppler
0.86.0` but the workaround was still left hanging in `epdfinfo.c`
which brings us to today where this unneeded translation bites our
back. I commented out the calls to
`annotation_translate_quadrilateral` in `epdinfo.c` and to my
surprise, there were no misplaced translations in files which
displayed the misplacing behaviour and in files which did not have
this behaviour.
[1]:
https://github.com/politza/pdf-tools/commit/0107f80dcf268d08ac075b01729820062c0fbd67
[2]: politza/pdf-tools#122
Closes: #143
Closes: #146
|
|
They aren't used.
Fixes #138.
|
|
This commit also removes C++ entirely, as it is not needed anymore for
correct compilation of `epdfinfo`. The following changes are made:
- Remove private headers from all the server code. This involves:
- Replace private header functionality with the correct public
functions provided by poppler.
- Remove unneeded headers around date checks
- Delete dead-code (headers, m4 macros)
- Remove C++, g++ and similar aliases from all the code. Also:
- Remove related information from the README
- Remove related information from CI and Dockerfiles
Work done by: @Pi-Cla
Closes: #105, #103, #109, #114
|
|
This reverts commit 37bbe861755bc60c7cc333359fee3e2a5d919c77.
As explained by @ShuguangSun (re: testing the change on Windows) on
> Sorry. It is my fault. The issue is still there. The different is
> that the temp dir is created now. However, it reports "Unable to
> create temporary file".
Reopens: #110
|
|
This reverts commit 8ee31220a6ae3e41549bfffca7a89c481d270004 and
brings in @JunyuanChen's change once again.
We modify the commit to fix the problem on Windows by changing the
code as follows:
--- a/server/epdfinfo.c
+++ b/server/epdfinfo.c
@@ -347,6 +347,6 @@
static char*
mktempfile()
{
- char template[] = "/tmp/epdfinfoXXXXXX";
+ char template[] = P_tmpdir "/epdfinfoXXXXXX";
char *filename = malloc(sizeof(template));
memcpy(filename, template, sizeof(template));
This works correctly for Windows (as confirmed by @ShuguangSun),
Mac (tested by @vedang) and Linux (tested by @Junyuanchen)
Relates to: #101, #94
Closes: #110
|
|
This reverts commit d63a1e7d87f9b0a19209f2eeb170bcf64612aa2f.
In d63a1e7, @JunyuanChen fixed a long standing compilation warning by
replacing `tempnam` with `mkstemp` in `epdfinfo`. However, the
`mkstemp` implementation does not work correctly on MS
Windows (probably because the path template is "wrong" for Windows).
I am reverting the commit and opening a new issue #110 to track the
correct implementation of `mkstemp` (or equivalent) on MS Windows.
It would also be great to add a test against Windows CI to open a PDF
and check that the operation completes successfully.
Closes: #101
|
|
Removes the following warning when compiling `epdfinfo`:
```
build/server/epdfinfo.c:354: warning: the use of `tempnam' is
dangerous, better use `mkstemp'
```
|
|
The correct possessive with it is "its", not "it's".
Closes: politza#689
|
|
|
|
Typos found with codespell.
|
|
Discard synctex's stdout by redefining printf as before.
|
|
|
|
|
|
|
|
|
|
Added some functions missing in Windows. Switch to binary mode
on stdin and stdout to avoid line ending issues.
|
|
|
|
*server/epdfinfo.c(annotation_print): Make error label conditional.
|
|
* server/epdfinfo.c (main): Withou args redirect to /dev/null.
|
|
* server/epdfinfo.c (cmd_ping): Pong.
* lisp/pdf-info.el (pdf-info-ping): Handle it.
|
|
* server/epdfinfo.c (cmd_renderpage): Use the correct transformations.
|
|
* server/epdfinfo.c (cmd_renderpage): Incorporated cmd_renderpage_x
commands into cmd_renderpage.
* lisp/pdf-view.el (pdf-view-extract-region-image): Use new rendering capabilities.
* lisp/pdf-info.el (pdf-info-renderpage): Adhere to and provide new command protocol.
(pdf-info-renderpage-text-regions): Use pdf-info-renderpage.
(pdf-info-renderpage-highlight): Use pdf-info-renderpage.
|
|
* server/epdfinfo.c (cmd_renderpage_highlight): Drop the x/y-offsets,
otherwise the visuals do not accurately represent the selected
region.
|
|
* server/epdfinfo.c (image_recolor): Use PopplerColor as argument. Some renaming.
(image_render_page): Apply signature difference.
|
|
|
|
Conflicts:
lisp/pdf-info.el
server/epdfinfo.c
server/epdfinfo.h
|
|
* server/epdfinfo.c: New command pagelabels.
* lisp/pdf-view.el (pdf-view-goto-label): New command for going to the
page corresponding to it's label.
(pdf-view-mode-map): Bind it to `M-g l' .
* lisp/pdf-outline.el (pdf-outline-display-labels): New option for
displaying labels instead of page numbers.
(pdf-outline-insert-outline, pdf-outline-insert-outline,
pdf-outline-imenu-create-item, pdf-outline-imenu-create-index-flat,
pdf-outline-imenu-create-index-tree,
pdf-outline-imenu-create-index-tree-1): Handle it.
* lisp/pdf-info.el (pdf-info-pagelabels): New command returning a list of pagelabels.
(pdf-info-query--transform-response): Handle it.
* NEWS: Add news items.
|
|
* server/configure.ac: Check for error.h
* server/epdfinfo.h:
* server/epdfinfo.c: Use result of above check.
* server/autogen.sh: Use /bin/sh instead of bash.
|
|
* server/epdfinfo.c (image_write): Use a buffer for writing.
|
|
* server/epdfinfo.c (cmd_open): g_filename_to_uri already checks for absolutity.
|
|
* server/epdfinfo.c: Remove get- and setoptions
|
|
|
|
* server/epdfinfo.h (DEC_CMD, DEC_CMD2): New macros.
* server/epdfinfo.c (commands): Use macros.
|
|
* server/epdfinfo.c (command_arg_parse_arg): Remove ARG_QUADRILATERAL.
* server/epdfinfo.h (command_arg_type_t): Dito.
|
|
* server/epdfinfo.h (DEC_CMD, DEC_CMD2, DEC_DOPT): Macros for
declaring commands and options.
* server/epdfinfo.c (command_arg_parse_arg): Removed unused ARG_QUADRILATERAL.
(command_arg_print, command_arg_type_size): New function.
(document_options): New array holding document options.
(cmd_getoptions, cmd_setoptions): Use above array.
(commands): Use Macros.
|
|
* server/epdfinfo.h : Add option structs.
* server/epdfinfo.c (image_render_page): Use struct as argument.
(cmd_getoptions, cmd_setoptions): New commands.
* lisp/pdf-info.el (pdf-info-query--transform-response,
pdf-info-getoptions, pdf-info-setoptions): Handle new commands.
|
|
* lisp/pdf-info.el (pdf-info-query--transform-response): Put match
face properties on the matched text of the line.
(pdf-info-search-string): The returned line now contains face
properties on the matched part.
(pdf-info-search-regexp): This function now searches for PCRE, and as
such the calling convention has changed to support the various flags
of the underlying engine.
(pdf-info-regexp-compile-flags, pdf-info-regexp-match-flags):
List of regexp flags.
* server/epdfinfo.c: (cmd_search_regexp): Use complex numeric flags of
the new engine instead of the old boolean ones. Now returns both
the matched text and it's corresponding line.
(cmd_search_string): Return both as well.
(cmd_regexp_flags): New command returning regexp flags and their values.
* lisp/pdf-util.el (pdf-util-highlight-regexp-in-string): New function
for propertizing a string.
(pdf-util-edges-union): Added minor optimization.
|
|
* server/epdfinfo.c: Don't include poppler Error.h when compiling for
* cygwin. (There may be a better fix, i.e change the include path priorities?)
server/epdfinfo.h: Dito
|
|
* server/epdfinfo.c (region_print): Print a zero sized region at 0,0.
|
|
* server/epdfinfo.c (main): Use `a'.
|
|
* server/poppler-hack.cc (poppler_annot_markup_get_type): Remove
unused variable.
* server/epdfinfo.c (cmd_charlayout): Use proper type.
(main): Initialize variable.
|
|
* server/epdfinfo.c (cmd_charlayout): Provides edges of character.
* lisp/pdf-info.el (pdf-info-query--transform-response): Added transform.
(pdf-info-charlayout): Added interface for the command.
|