[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Djvu mode

From: Camm Maguire
Subject: Re: Djvu mode
Date: Sun, 02 Oct 2011 00:22:29 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)


"Roland Winkler" <address@hidden> writes:

> On Thu Sep 29 2011 Camm Maguire wrote:
>> ... or just remove the -u from the code, your text will have a few
>> control codes, but you should still be able to get the idea.
> Thanks, this works.
>> There are two highlighting modes, one by just dragging mouse-1 over
>> any rectangle, which allows selection of text or an underlying image
>> such as a graph (see "q" and "i"), and one anchored to the text,
>> whereby if you click on the image of word 1, which appears in the
>> minibuffer, and then on word 2, which does likewise, you can do "h" to
>> highlight that region.  Dragging mouse-3 removes any overlapping
>> highlighted region.
> What kind of highlighting are you talking about: highlighting that
> is just visible while the document is displayed? Or highlighting via
> the maparea annotation syntax that is permanently stored in the djvu
> document? -- With your code, when I view a djvu document that

Both, but see below.

> already contains maparea annotations the respective areas are not
> highlighted in emacs.

Currently the code ignores but preserves non-djvm-mode produced
annotations, but this should be easy to add.  

For example, drag a box with mouse-1, then type 'k' (for "keep"), then
's' for save.  The highlighted rectangle is now permanent.  Dragging
with mouse-3 over an overlapping box removes the highlight, and then
's' will eliminate it from the file.

Or mouse-1 on a word, which should appear in the minibuffer blow, then
another, then type 'h' for highlight, then 'k' and 's'.  This allows
highlighting anchored on word boundaries.

In either case, 'q' gives the text in the most recent highlighted box
by default, but with a prefix 'q' allows mouse-1 to select a different
region.  'i' works the same for an extracted sub-image.

You can mouse-1 on a word, then hit 'e' and see the text layer in lisp
with the point at the word in question.  You can edit, then save to
the file with C-cC-c.

'c' prompts for mouse-1 to select a highlighted region, and then
another mouse-1 to select a text box note location, then creates a
buffer for you to add any text note at that spot in the document.  The
new box appears as a pushpin note in djview.

'w' highlights words by regexp, adding to a list until cleared by 'w'
with a prefix.

'r' does reverse illumination.  'n' and 'p' advance and turn back
pages, taking an argument for the number to skip.  M-g g advances to a
given page as elsewhere in emacs.

'+'/'-' enlarges or shrinks the image.  C-cC-c toggles to a flat text
representation of the text layer, built from the file rather than
djvused as the latter does not consistently place page feed control
codes.  These are needed to sync the text and image pages.  So
navigating either in text or image, and then C-cC-c gives you the
image or text on the same page.  Thus isearch works on images too.

> On the other hand adding these maparea annotations to a djvu
> document is really one of the things I wanted to achieve with my
> code. I am currently using djview for viewing the final result as it

Me too.  This is the main point.  I am currently using it for this
with success.  I'm not really sure though whether text notes are best
placed in the file, as you have to click on the box to see them (in
emacs djvm mode or djview), or whether org-mode should be used for
notes on the document.  I can describe the attached org-mode support
if you are interested.  I seem to prefer this at the moment.

> nicely displays these annotations including any text layers they
> might have.

Emacs with this mode does too, but just for the annotations it writes
itself at the moment.  It labels these with a "djvm" comment.

> Also, with your code I am a bit surprised that when I search a text
> string, the highlighting produced by emacs is not properly aligned
> with the underlying picture which is somewhat annoying.

This is a somewhat common indication of a poorly constructed text
layer by an early ocr engine.  I've always cleared this by a fresh
ocrodjvu --in-place foo.djvu.  Boxes then line up perfectly.  I think
the ocr code has only very recently matured.

Take care,

> Roland

Camm Maguire                                        address@hidden
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]