Skip to content

Better consistency in createXPointer(pt), more robust EPUB ToC ncx parsing#650

Merged
poire-z merged 3 commits into
koreader:masterfrom
poire-z:createXPointer_consistent
Feb 13, 2026
Merged

Better consistency in createXPointer(pt), more robust EPUB ToC ncx parsing#650
poire-z merged 3 commits into
koreader:masterfrom
poire-z:createXPointer_consistent

Conversation

@poire-z

@poire-z poire-z commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Epub ncx TOC: don't skip items with invalid href

As they may have children with valid href.

Avoid some compiler warnings

Mostly "warning: 'xyz' may be used uninitialized".

Also add forgotten ctxFlag to xpFirstLetter.getRect() and remove unused prevCharRectCtx.

ldomDocument::createXPointer(pt): better consistency

Previously, we would return a xpointer to the next glyph if our pt was in the right half of a glyph. Now, always return a xpointer to that glyph.
Also, when pt is in the blank between words (caused by text justification), handle it as if part of previous word, which will return a xpointer to after the end of that word (so, usually to the start of next word).
Should allow fixing (with changes in cre.cpp) most of the issues notices all along koreader/koreader#12135.


This change is Reviewable

@poire-z poire-z force-pushed the createXPointer_consistent branch from 5937958 to bfb7f7c Compare February 3, 2026 00:27
@poire-z poire-z force-pushed the createXPointer_consistent branch from bfb7f7c to da5ce2f Compare February 13, 2026 22:35
As they may have children with valid href.
Mostly "warning: 'xyz' may be used uninitialized".

Also add forgotten ctxFlag to xpFirstLetter.getRect()
and remove unused prevCharRectCtx.
Previously, we would return a xpointer to the next glyph
if our pt was in the right half of a glyph. Now, always
return a xpointer to that glyph.
Also, when pt is in the blank between words (caused by
text justification), handle it as if part of previous
word, which will return a xpointer to after the end of
that word (so, usually to the start of next word).
@poire-z poire-z force-pushed the createXPointer_consistent branch from da5ce2f to 9c51ca0 Compare February 13, 2026 22:36
@poire-z poire-z merged commit d0ec37d into koreader:master Feb 13, 2026
1 check passed
@poire-z poire-z deleted the createXPointer_consistent branch February 13, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants