From: Eli Zaretskii <eliz@gnu.org>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: emacs-devel@gnu.org
Subject: Re: Printing to STDERR when %d is "Cannot access memory ..."
Date: Wed, 13 Jun 2018 22:46:54 +0300 [thread overview]
Message-ID: <83tvq631w1.fsf@gnu.org> (raw)
In-Reply-To: <m2po0ulbux.wl%esq@lawlist.com> (message from Keith David Bershatsky on Wed, 13 Jun 2018 12:34:14 -0700)
> Date: Wed, 13 Jun 2018 12:34:14 -0700
> From: Keith David Bershatsky <esq@lawlist.com>
> Cc: emacs-devel@gnu.org,Davis Herring <herring@lanl.gov>
>
> My STDERR printout (with the NULL font now being assigned a 0 value) is as follows:
>
> it->c (120021)
> char (ð)
> w->hscroll (0)
> hscl (false)
> it->hpos (5)
> it->vpos (0)
> it->current_x (55)
> new_x (55)
> font->space_width (0)
> it->lnum_pixel_width (55)
> it->lnum_width (3)
> it->first_visible_x (0)
> relative_x (55)
> it->face_id (38)
> foreground_face (magenta)
> background_face (black)
> rc (MOVE_X_REACHED)
>
> I create the font pointer like this .... It has worked for everything so far except this special character (U0001D4D5) on Emacs built --with-x. I believe the face_id is correct in this example because the foreground (magenta) and background (black) are correctly returned.
>
> struct face *face = mc_lookup_face (it);
> struct font *font = face->font;
> Lisp_Object foreground_face = face->lface[LFACE_FOREGROUND_INDEX];
> Lisp_Object background_face = face->lface[LFACE_BACKGROUND_INDEX];
>
> ... using the following function:
>
> struct face *
> mc_lookup_face (struct it *it)
> {
> if (!NILP (Vface_remapping_alist)
> && (it->face_id == DEFAULT_FACE_ID /* Qdefault */
> || it->face_id == MODE_LINE_FACE_ID /* Qmode_line */
> || it->face_id == MODE_LINE_INACTIVE_FACE_ID /* Qmode_line_inactive */
> || it->face_id == HEADER_LINE_FACE_ID /* Qheader_line */
> || it->face_id == TOOL_BAR_FACE_ID /* Qtool_bar */
> || it->face_id == FRINGE_FACE_ID /* Qfringe */
> || it->face_id == SCROLL_BAR_FACE_ID /* Qscroll_bar */
> || it->face_id == BORDER_FACE_ID /* Qborder */
> || it->face_id == CURSOR_FACE_ID /* Qcursor */
> || it->face_id == MOUSE_FACE_ID /* Qmouse */
> || it->face_id == MENU_FACE_ID /* Qmenu */
> || it->face_id == WINDOW_DIVIDER_FACE_ID /* Qwindow_divider */
> || it->face_id == WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID /* Qwindow_divider_first_pixel */
> || it->face_id == WINDOW_DIVIDER_LAST_PIXEL_FACE_ID /* Qwindow_divider_last_pixel */
> || it->face_id == VERTICAL_BORDER_FACE_ID /* Qvertical_border */
> || it->face_id == INTERNAL_BORDER_FACE_ID)) /* Qinternal_border */
> return FACE_FROM_ID (it->f, lookup_basic_face (it->f, it->face_id));
> else
> return FACE_FROM_ID (it->f, it->face_id);
> }
I don't think face->font is guaranteed to be non-NULL. You need to
check that explicitly, and you need some fallback for when it is NULL,
to serve as a substitute for font->space_width.
next prev parent reply other threads:[~2018-06-13 19:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-13 19:34 Printing to STDERR when %d is "Cannot access memory ..." Keith David Bershatsky
2018-06-13 19:46 ` Eli Zaretskii [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-06-13 21:37 Keith David Bershatsky
2018-06-13 19:34 Keith David Bershatsky
2018-06-13 18:37 Keith David Bershatsky
2018-06-13 18:50 ` Davis Herring
2018-06-13 19:11 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83tvq631w1.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=esq@lawlist.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).