1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-09 13:10:57 -08:00
Commit graph

49051 commits

Author SHA1 Message Date
Yuan Fu
8044140b54
Revert e8df6c311f 2023-12-26 22:37:19 -08:00
Po Lu
60199ac01d ; * src/ftfont.c (ftfont_glyph_metrics): Comment on advance rounding. 2023-12-26 14:10:57 +08:00
Po Lu
cd91ecedcb Consistently round glyph advances in the SFNT font backend
* src/sfnt.h (SFNT_ROUND_FIXED): New macro.

* src/sfntfont.c (sfntfont_get_glyph_outline): Don't apply
advance width distortion before the glyph is instructed or
decomposed.  Round advance width as measured between both
phantom points subsequent to instruction code execution.
(sfntfont_draw): Don't take the advance's ceiling when advancing
origin point.
2023-12-26 14:10:57 +08:00
Po Lu
1be132731d Apply TTF advance width rounding to uninstructed glyphs
* src/sfnt.c (sfnt_scale_metrics):

* src/sfntfont.c (sfntfont_get_glyph_outline): Round advance and
floor lbearing scaling glyph metrics.
(sfntfont_measure_pcm): Don't round or truncate metrics which
have already been.
2023-12-25 15:38:15 +08:00
Po Lu
995dd36da1 Optimize font edge filling loop
* src/sfnt.c (sfnt_fedge_sort): Delete function.
(sfnt_poly_edges_exact): Don't sort edges, iterate through each
instead.
(main): Adjust tests.
2023-12-25 11:21:15 +08:00
Stefan Monnier
ba3d3c699e * src/eval.c (signal_or_quit): Fix naming inconsistency with docs
The var's docstring and etc/NEWS refer to "*Redisplay-trace*",
so better use that (which is also more in line with usual practice
of Emacs buffer names).
2023-12-24 10:13:22 -05:00
Eli Zaretskii
43cacc31be ; * src/eval.c (Fdefvar): Doc fix (bug#67991). 2023-12-24 09:31:32 +02:00
Po Lu
13182ae976 ; * src/xdisp.c (draw_glyphs): Fix coding style. 2023-12-23 20:50:16 +08:00
Eli Zaretskii
1be6204473 Merge from origin/emacs-29
a475165738 * doc/man/emacsclient.1: Fix --tramp option.
1e5357d3d1 * doc/man/emacsclient.1: Add missing sections (bug#66598)
fba7b9db39 Add explanation for extra parentheses in ELisp Introduction
7723282682 Add sample code to the "let*" section in "forward-paragraph"
7a00ca92c1 Fix treesit test (bug#67117)
d220893216 Fix c++-ts-mode indentation (bug#67975)
d386a8aa43 Recommend customizing eglot for python-base-mode
bd0c758971 Improve documentation of new native-compilation commands
1ad126c0f2 ; Fix typo
77678244b8 doc/lispintro: Don't mention `set` (bug#67734)
cb3684e9df Fix script for some characters
2922d683b7 ; * src/treesit.c (treesit_traverse_child_helper): Fix co...
7b315e8a5c Fix an issue when searching subtree backward (bug#67117)
03625c2fef Fix passive mode for tnftp client in ange-ftp.el.
b6429b1c1c ; Improve documentation of ispell.el's dictionary database
75cc159341 ; * etc/PROBLEMS: Update the "GnuPG hangs" entry.
67d9af1c07 Fix using disabled command without a docstring
f68f350023 Improve documentation of text properties handling when ya...
06c399914f Eglot: Add Uiua language server
2023-12-23 06:30:40 -05:00
Manuel Giraud
e69fafdbc8 Respect mouse-face on SVG image glyphs (bug#67794)
* src/dispextern.h:
* src/image.c (image_spec_value): Export 'image_spec_value'.
* src/xdisp.c (draw_glyphs): Maybe update SVG image glyphs with
mouse face features before drawing.
2023-12-23 12:21:18 +02:00
Eli Zaretskii
23cc2d192c ; * src/sfnt.c (sfnt_interpret_compound_glyph_2): Reword a comment. 2023-12-23 09:32:04 +02:00
Gerd Möllmann
a63b206fbd Use new safe_calln on NS
* src/nsterm.m (ns_in_echo_area_1): Use safe_calln.
([EmacsView draggingUpdated:]): Use safe_calln.
2023-12-23 07:06:06 +01:00
Stefan Monnier
0fde935b66 Split safe_call between redisplay and non-redisplay versions
The `safe_call/eval` family of functions started its life in `xdisp.c`
for the needs of redisplay but quickly became popular outside of it.
This is not ideal because despite their name, they are somewhat
specific to the needs of redisplay.

So we split them into `safe_call/eval` (in `eval.c`) and `dsafe_call/eval`
(in `xdisp.c`).  We took this opportunity to slightly change their
calling convention to be friendly to the CALLN-style macros.
While at it, we introduce a new `calln` macro as well which does
all that `call[1-8]` used to do.

* src/eval.c (safe_eval_handler, safe_funcall, safe_eval): New functions,
Copied from `xdisp.c`.  Don't obey `inhibit_eval_during_redisplay` any more.
Adjust error message to not claim it happened during redisplay.

* src/lisp.h (calln): New macro.
(call1, call2, call3, call4, call5, call6, call7, call8): Turn them
into aliases of `calln`.
(safe_funcall): Declare.
(safe_calln): New macro.
(safe_call1, safe_call2): Redefine as compatibility macros.
(safe_call, safe_call1, safe_call2): Delete.
Replace all callers with calls to `safe_calln`.

* src/xdisp.c (dsafe_eval_handler): Rename from `safe_eval_handler`.
Adjust all users.
(dsafe__call): Rename from `safe_call` and change calling convention to
work with something like CALLMANY.  Adjust all users.
(safe_call, safe__call1, safe_call2): Delete functions.
(SAFE_CALLMANY, dsafe_calln): New macros.
(dsafe_call1, dsafe_eval): Rename from `safe_call1` and `safe_eval`,
and rewrite using them.  Adjust all users.
(clear_message, prepare_menu_bars, redisplay_window): Use `dsafe_calln`.
(run_window_scroll_functions): Don't let-bind `Qinhibit_quit`
since `safe_run_hooks_2` does it for us.
2023-12-23 00:25:46 -05:00
Po Lu
9aea075f5f Respect glyph metrics modified by instruction code
* src/sfnt.c (sfnt_read_glyph): Clear advance and origin
distortion returning an empty glyph.
(sfnt_build_instructed_outline): New parameter *ADVANCE_WIDTH,
in which the glyph's advance width is saved.
(sfnt_interpret_compound_glyph_1): Refine commentary.
(sfnt_verbose, main): Adjust tests.

* src/sfnt.h: Update prototypes correspondingly.

* src/sfntfont.c (sfntfont_get_glyph_outline): If an instructed
outline is available, derive the advance and lbearing from the
measurements within.
(sfntfont_probe_widths): Call sfntfont_measure_pcm to establish
average widths.
(sfntfont_open): Do so after instruction code initialization
completes.
(sfntfont_measure_pcm): Revise commentary.
2023-12-23 11:22:21 +08:00
Mattias Engdegård
1ece474c69 Slight funcall_subr optimisation
* src/eval.c (funcall_subr): Help the compiler by reducing aliasing
problems, and compensate for a missed-optimisation bug in LLVM where
switches sometimes forget to use variable range information (reported
in https://github.com/llvm/llvm-project/issues/76085).
2023-12-22 14:13:23 +01:00
Po Lu
f34f474e38 Properly instruct compound glyphs with compound components
* src/sfnt.c (sfnt_interpret_compound_glyph_2): Don't grow the
compound decomposition context for saving compound points into,
since the space for them already exists.
2023-12-22 10:26:08 +08:00
Po Lu
04883c36a6 Implement an undocumented TrueType "feature"
* src/sfnt.c (sfnt_move): Correct commentary.
(sfnt_interpret_control_value_program): Reset dual projection,
freedom and projection vectors, in addition to the reference
points, zone pointers and loop counter.
2023-12-21 16:31:30 +08:00
Po Lu
e6d8e23ede * src/sfnt.c (GETINFO): Implement undocumented selector bit 5. 2023-12-21 14:35:18 +08:00
Po Lu
22da40a5e5 Accept empty contours in glyphs
* src/sfnt.c (sfnt_decompose_glyph_1, sfnt_decompose_glyph_2):
Accept empty contours, for they are not invalid, just redundant.
2023-12-21 13:37:49 +08:00
Eli Zaretskii
2922d683b7 ; * src/treesit.c (treesit_traverse_child_helper): Fix comment. 2023-12-19 18:53:18 +02:00
Eli Zaretskii
281be72422 ; * src/eval.c (syms_of_eval) <debugger>: Doc fix. 2023-12-19 14:20:24 +02:00
Po Lu
0a57e1cd2c Improve efficiency of operations involving font interpreter scale
* src/sfnt.c (sfnt_mul_f26dot6_fixed): Correct rounding
constant.
(sfnt_make_interpreter, SSW, WCVTF, sfnt_compute_phantom_points)
(sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_1)
(sfnt_vary_interpreter, sfnt_check_ssw): Account for the
fractional bits in a f26dot6 when computing the interpreter
scale factor.
2023-12-19 16:42:38 +08:00
Po Lu
d0e3dfa764 Properly sign-extend freedom and projection vector values
* src/sfnt.c (GPV, GFV): Cast versors to int32_t.
2023-12-19 14:41:38 +08:00
Po Lu
f2693751dd Further corrections to font scaling
* src/sfnt.c (sfnt_dot_fix_14): Correct typo in final division.
(sfnt_compute_phantom_points): New parameters S1 and S2, into
which unrounded phantom point coordinates are saved.
(sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_2)
(sfnt_interpret_compound_glyph_1): Adjust correspondingly.

* src/sfntfont.c (sfntfont_get_glyph_outline): Delete redundant
branch.
2023-12-19 13:41:16 +08:00
Denis Zubarev
7b315e8a5c
Fix an issue when searching subtree backward (bug#67117)
* src/treesit.c (treesit_traverse_child_helper):
Do not call treesit_traverse_sibling_helper when the named node is
required and the last child is the named node.
Otherwise treesit_traverse_sibling_helper will move cursor to the
previous sibling and last node will be skipped.
* test/src/treesit-tests.el (treesit-search-subtree-forward-1):
(treesit-search-subtree-backward-1):
Add tests.
2023-12-18 18:25:26 -08:00
Stefan Monnier
6937182a0e debug.el: Straighten the code that find the "base" of the backtrace
Let the caller tell us clearly where is the base of the backtrace,
if it's not `debug`.  This is done by passing a new `:backtrace-base`
keyword argument to `debug`.

Then use this info systematically in all the places where we access
the real C-level backtrace, to try and avoid inconsistencies and brittle
code that tries to enumerate the expected frames we're in.

* src/eval.c (get_backtrace_starting_at): Add support for offsets in the
`base` argument.
(Fbacktrace_debug): Add optional `base` argument.

* lisp/emacs-lisp/debug.el (debug, debugger-frame, debugger-frame-clear):
Use `debugger--backtrace-base` when calling `backtrace-debug`.
(debugger-setup-buffer): Use `debugger--backtrace-base`
when calling `backtrace-get-frames`.
(debugger-frame-number): Drop `skip-base` arg, assume it's never nil.
Add sanity check.
(debugger--backtrace-base): Use the `:backtrace-base` info
in `debugger-args`.
(debugger-eval-expression): Adjust call to `debugger-frame-number`.
(debug--implement-debug-on-entry): Pass appropriate `:backtrace-base`.
2023-12-18 17:52:58 -05:00
Po Lu
1d5d2f16c3 Further fixes for problems uncovered by the previous fix
* src/sfnt.c (sfnt_deltap): Enable deltap instructions again,
since they now serve a purpose.
(sfnt_compute_phantom_points): Round phantom points to match the
behavior of other TrueType scalers.
2023-12-18 22:14:22 +08:00
Po Lu
1abba7bfa4 ; * src/sfnt.c: Fix typo. 2023-12-18 20:58:53 +08:00
Po Lu
a54bec26c4 * src/sfnt.c (sfnt_interpret_mdap): Correct MDAP opcode. 2023-12-18 20:57:24 +08:00
Po Lu
14504fca8b Fix typo in earlier changes
* src/sfnt.c (sfnt_poly_edges_exact): Don't overwrite the
remainder of an ascending edge with its covered height.
(main): Adjust tests.
2023-12-18 13:34:29 +08:00
Po Lu
103f36cced Enable the new font scaler
* src/sfnt.c (sfnt_curve_is_flat): Tighten threshold for flat
curves.
(sfnt_insert_raster_step): Rewrite loop for clarity.
(sfnt_poly_set_steps): New function; fill small spans with a
plain unexceptional loop rather than memset.
(sfnt_poly_steps): Call that function.
(sfnt_verbose, main): Adjust tests such that the scaler can be
selected at runtime.

* src/sfnt.h: Update prototypes.

* src/sfntfont.c (sfntfont_get_glyph_raster)
(syms_of_sfntfont) <sfnt_raster_glyphs_exactly>: New variable.
2023-12-18 11:10:40 +08:00
Po Lu
678a594f4f * src/sfnt.h (sfnt_coerce_fixed): New macro. 2023-12-17 20:55:43 +08:00
Po Lu
8e10aad3ab ; * src/sfnt.c: Fix typos. 2023-12-17 20:55:43 +08:00
Po Lu
6f14fc5f3d Introduce the rudiments of a new font rasterizer
* src/sfnt.c (xzalloc): New function.
(sfnt_poly_edges): Remove redundant statement.
(sfnt_add, sfnt_sub, sfnt_mul): Move macro definitions above the
new scaler.
(sfnt_build_outline_fedges, sfnt_insert_raster_step)
(sfnt_fedge_sort, sfnt_poly_edges_exact, sfnt_compute_fill)
(sfnt_poly_steps, sfnt_raster_steps, sfnt_raster_edges_exact)
(sfnt_raster_glyph_outline_exact): New functions, presently
disabled.
(sfnt_x_raster, main): Introduce new tests.
2023-12-17 20:55:43 +08:00
Stefan Kangas
8c448c6b4f Silence warning in print.c
* src/print.c (print_bool_vector): Silence warning.
2023-12-17 11:58:24 +01:00
Eli Zaretskii
a1d3862c62 Merge from origin/emacs-29
bf4ccb0be0 ; * lisp/term.el (term--xterm-paste): Fix last change.
0d9e2e448d ; * doc/lispref/functions.texi (Function Documentation): ...
791cc5065d Fix shaping of Sinhala text
efcbf0b5ab Add use cases of (fn) documentation facility.
c3331cb365 Fix pasting into terminal-mode on term.el
5be94e2bce Fix opening directory trees from Filesets menu
6b6e770a1f Eglot: Add ruff-lsp as an alternative Python server
ed8a8a5ba1 Fix symbol name in Multisession Variables examples
400ef15bdc js-ts-mode: Fix font-lock rules conflict
c165247c30 Add indentation rules for bracketless statements in js-ts...
7f1bd69cd1 Fix c-ts-mode bracketless indentation for BSD style (bug#...
e23068cb9a Add missing indent rules in c-ts-mode (bug#66152)
d2c4b926ac Fix treesit-default-defun-skipper (bug#66711)
9874561f39 Fix treesit-node-field-name and friends (bug#66674)
eace9e1122 python-ts-mode: Highlight default parameters
23c06c7c30 Update to Org 9.6.13
2023-12-16 09:17:51 -05:00
Eli Zaretskii
8b3fc98338 ; * src/androidfns.c (syms_of_androidfns) <android-os-language>: Doc fix. 2023-12-16 11:13:33 +02:00
Po Lu
d9814efe07 ; * src/androidfns.c (syms_of_androidfns_for_pdumper): Fix crash. 2023-12-14 13:57:59 +08:00
Po Lu
de25aaa11a Respect Language & Input preferences under Android
* doc/emacs/android.texi (Android Environment):

* doc/emacs/cmdargs.texi (General Variables): Mention the manner
in which the default language environment is selected on
Android.

* lisp/startup.el (normal-top-level): If android and
initial-window-system, call android-locale-for-system-language
for the default locale name.

* lisp/term/android-win.el (android-locale-for-system-language):
New function.

* src/androidfns.c (syms_of_androidfns_for_pdumper): New
function.
(syms_of_androidfns) <Vandroid_os_language>: New variable.
Call syms_of_androidfns_for_pdumper both now and after
loading the dump image.
2023-12-14 13:24:42 +08:00
Po Lu
1ec8e76bcf Correct implementation of UTP
* src/sfnt.c (sfnt_interpret_utp): Derive which flags to reset
from the freedom vector.
2023-12-11 11:28:34 +08:00
Yuan Fu
9874561f39
Fix treesit-node-field-name and friends (bug#66674)
So turns out ts_node_field_name_for_child takes a named node index,
but we were passing it normal index that counts both named and
anonymous nodes.  That's what makes the field name all wrong in
treesit explorer.

* doc/lispref/parsing.texi:
(Accessing Node Information): Update docstring.
* lisp/treesit.el (treesit-node-index): Add some unrelated comment.
(treesit-node-field-name): Get named node index rather than all node
index.
* src/treesit.c (Ftreesit_node_field_name_for_child): Update
docstring, use ts_node_named_child_count.
2023-12-10 16:28:21 -08:00
Eli Zaretskii
0da2a4650c Merge from origin/emacs-29
2773cf9e01 ; Fix typos
020aff95fa ; Fix typos in ChangeLog files
5e03a621ef ; * lisp/progmodes/c-ts-mode.el (c-ts-mode--else-heuristi...
f0734e1c0d Fix c-ts-mode indent heuristic (bug#67417)
08fc6bace2 Fix c-ts-mode indentation (bug#67357)
71bc2815cc Add font-locking for hash-bang lines in typescript-ts-mode.
db8347c8c8 Add font-locking for hash-bang lines in js-ts-mode
91f2ade57b ruby-mode: Better detect regexp vs division (bug#67569)
2023-12-10 10:35:54 -05:00
Stefan Kangas
7d283ca1a3 ; Fix a few more typos 2023-12-10 14:06:45 +01:00
Stefan Kangas
06a12b0ccc ; Fix typos 2023-12-10 13:22:04 +01:00
Stefan Kangas
2773cf9e01 ; Fix typos 2023-12-10 12:39:54 +01:00
Stefan Kangas
020aff95fa ; Fix typos in ChangeLog files 2023-12-10 12:38:19 +01:00
Eli Zaretskii
486094126b Merge from origin/emacs-29
0f361cc985 ; Minor copyedits in description of ':box' face property
46fe7a17f5 Fix dragging mode line on text terminals with a mouse (bu...
12daf386f3 ; * doc/lispref/processes.texi (Network): Fix wording and...
037d858dc1 (rust-ts-mode): Set electric-indent-chars
dc9b733ab8 js-ts-mode: Highlight function parameters inside destruct...
4a72f13bdf js-ts-mode: Highlight property shorthands in assignments
83ed9018ed (js--treesit-font-lock-settings): Highlight parameters in...
ad0f87bb4c (js--treesit-font-lock-settings): Remove some duplicates
71c5f3694f ; Another fix of doc string of 'message-mail-user-agent' ...
04a39353ba ; * lisp/gnus/message.el (message-mail-user-agent): Doc f...
82ddcf37ec ; * doc/lispref/files.texi (Changing Files): Fix last cha...
89068516b3 Don't claim to signal an error when deleting a nonexistin...
4fd254e183 * lisp/indent.el (indent-rigidly): Improve prompt (bug#67...
5f923ff1a6 ; Fix typos
a1f88963f5 rust-ts-mode--comment-docstring: Handle block doc comments
a547b0e2e8 rust-ts-mode--comment-docstring: Fix/improve the previous...
2023-12-09 07:25:21 -05:00
Po Lu
414301bce1 Correct phantom point generation and MDAP
* src/sfnt.c (sfnt_interpret_mdrp): Cease applying cvt
cut in, as this is contrary to the specification.
(sfnt_interpret_simple_glyph): Correct typo.
(main): Revise tests.
2023-12-09 11:49:04 +08:00
Po Lu
3cf7d32b90 Display glyphs whose first contours commence at origin
* src/sfnt.c (sfnt_build_append): Don't disregard redundant
motion if outline is empty.  Problem encountered in the "M"
glyph within Source Code Pro VF Italic.
2023-12-08 10:55:02 +08:00
Po Lu
e4e1e268c8 Set a default locale on Android
* doc/emacs/android.texi (Android Environment): Revise for
change.

* src/android.c (initEmacs): Set LANG to either en_US.utf8 or C,
subject to whether the system is newer than Android
5.0 (inclusive).
2023-12-07 14:05:35 +08:00