Lisp HUG Maillist Archive

capi:editor-pane vs. unicode LWW

Under LWW, should a capi:editor-pane be able to display a unicode character 
(other than as a black rectangle)?

If I type:

(setq tt (string #\u+d183))
(capi:contain (make-instance 'capi:editor-pane :text tt))

it shows a black rectangle character instead of the appropriate glyph.

General problem:

I need to include in my gui a text editor that can display/edit unicode and 
has the minimum functionality of NotePad.  Is there some capi doo-dad that I 
should be using, or should I use a Windows EditControl (i.e. Notepad) 
directly?  A Windows-specific solution is OK, but I'd go for a portable 
version if it was easy.

thanks
pt


Re: capi:editor-pane vs. unicode LWW

Hello Paul,

| Under LWW, should a capi:editor-pane be able to display a unicode
| character (other than as a black rectangle)?
|
| If I type:
|
| (setq tt (string #\u+d183))
| (capi:contain (make-instance 'capi:editor-pane :text tt))
|
| it shows a black rectangle character instead of the appropriate glyph.

If you mean USC-2 code, this glyph is rather exotic  - it is missing from
the Adobe glyph list at least. But I believe the Editor can display it
provided you specify the corresponding font, for example:

(capi:contain (make-instance 'capi:editor-pane :text tt
   :font (gp:make-font-description :family "My-exotic-font-name"))

| General problem:
|
| I need to include in my gui a text editor that can display/edit unicode
| and has the minimum functionality of NotePad.  Is there some capi
| doo-dad that I should be using, or should I use a Windows EditControl
| (i.e. Notepad) directly?  A Windows-specific solution is OK, but I'd go
| for a portable version if it was easy.

The capi:editor-pane can do.

1. Create a buffer with :flag T, e.g.
  (let* ((buffer (editor:make-buffer (format nil "grid-~a"
                                   (get-internal-run-time))
                        :flag t)) ; exclude from the Editor buffer list

2. Provide the font argument (possibly equip your application with a GUI
dialog allowing the user to choose the font) and the buffer in
make-instance.

3. Create custom editor mode, e.g.
(editor:defmode "Grid"
    :setup-function 'setup-grid-mode
   :key-bindings  '(("Grid Left"  #\Left) ...)

4. Initialize the buffer mode on creation of the pane:
(setf (editor:buffer-minor-mode (capi:editor-pane-buffer pane) "Grid") t)

5. To trap more interesting events, provide customize input model, e.g.
(setf (capi:output-pane-input-model pane) *grid-text-input-model*
         (editor:variable-value 'editor::editor-interrupt-hook
             :buffer buffer)
          '(editor-interrupt-hook)))
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Updated at: 2020-12-10 08:45 UTC