Re: [evince] dvi text select and mouse-dvi alignment
- From: Mike Marchywka <marchywka hotmail com>
- To: "evince-list gnome org" <evince-list gnome org>
- Subject: Re: [evince] dvi text select and mouse-dvi alignment
- Date: Fri, 25 Oct 2019 11:26:27 +0000
On Fri, Oct 25, 2019 at 03:45:29AM -0600, Jason Crain wrote:
On 10/25/19 3:03 AM, Mike Marchywka via evince-list wrote:
1) The code I found looked like an error, the y-coord was apparently
shifted with border.right which sounds incorrect vs say border.top .
2) On the first page without scrolling the above y seems to work ok.
3) With scrolling, the text and mouse seemed to drift at about a 3-4 percent
rate hence the nice kluge. I wanted typeset the document as a single ( long )
page and aside from the obvious hazards of such a drift this becomes
a huge problem here. If this is some kind of fp round off or other known
problem it would be nice to fix- alternatively I can track it down as I wanted
to look at the coords anyway although hopefully mich later.
4) The use of the view->scale in the empircally working code does not seem
consistent, it has a value around
1.2 whcn I looked, and misuse should be an obvious problem
even on a normal page.
Was text select disabled on dvi for a reason or am I working with
very old code, apparently by source download is labelled
as evince-3.18.2.
Version 3.18.2 is from 2015. The newest version is 3.34.1. See
https://wiki.gnome.org/Apps/Evince/Downloads for links to the official
downloads.
As far as I know, the dvi backend has never supported the text interfaces.
Only the PDF and DjVu backends currently support it.
There very well may be a bug in evince, though since text selection is
working fairly well with PDF documents, if there is a bug, it might be
limited to only the DVI backend.
I guess I forgot I added margins to DviContext and got them from here,
see last two lines, this is from dvi-document.c. I have no idea
if these are baked into the other quantities somewhere,
static cairo_surface_t *
dvi_document_render (EvDocument *document,
EvRenderContext *rc)
{
cairo_surface_t *surface;
cairo_surface_t *rotated_surface;
DviDocument *dvi_document = DVI_DOCUMENT(document);
gdouble xscale, yscale;
gint required_width, required_height;
gint proposed_width, proposed_height;
gint xmargin = 0, ymargin = 0;
/* We should protect our context since it's not
* thread safe. The work to the future -
* let context render page independently
*/
g_mutex_lock (&dvi_context_mutex);
mdvi_setpage (dvi_document->context, rc->page->index);
ev_render_context_compute_scales (rc, dvi_document->base_width, dvi_document->base_height,
&xscale, &yscale);
mdvi_set_shrink (dvi_document->context,
(int)((dvi_document->params->hshrink - 1) / xscale) + 1,
(int)((dvi_document->params->vshrink - 1) / yscale) + 1);
ev_render_context_compute_scaled_size (rc, dvi_document->base_width, dvi_document->base_height,
&required_width, &required_height);
proposed_width = dvi_document->context->dvi_page_w * dvi_document->context->params.conv;
proposed_height = dvi_document->context->dvi_page_h * dvi_document->context->params.vconv;
if (required_width >= proposed_width)
xmargin = (required_width - proposed_width) / 2;
if (required_height >= proposed_height)
ymargin = (required_height - proposed_height) / 2;
mdvi_cairo_device_set_margins (&dvi_document->context->device, xmargin, ymargin);
mdvi_cairo_device_set_scale (&dvi_document->context->device, xscale, yscale);
mdvi_cairo_device_render (dvi_document->context);
surface = mdvi_cairo_device_get_surface (&dvi_document->context->device);
dvi_document->context->xmargin=xmargin; // mjm
dvi_document->context->ymargin=ymargin; // mjm
_______________________________________________
evince-list mailing list
evince-list gnome org
https://mail.gnome.org/mailman/listinfo/evince-list
--
mike marchywka
306 charles cox
canton GA 30115
USA, Earth
marchywka hotmail com
404-788-1216
ORCID: 0000-0001-9237-455X
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]