Hot Keys
========

As noted in hotkey :ref:`assignment <HotKeys.hotkeyassign>` you can nominate the
hotkeys which you prefer for all items in any menu of FontForge. Some default
hotkeys are shipped with FontForge so that you do not have to assign any keys
yourself unless you want to make changes. The defaults are shown below:

:Ctrl-A:            :ref:`Select All <editmenu.All>`
:Ctrl-Shift-A:      :ref:`Build Accented Glyph <elementmenu.Accented>`
:Alt-Ctrl-A:        :ref:`Select All Points <editmenu.SelectPoints>`
:Ctrl-B:            :ref:`Regenerate Bitmaps <elementmenu.Regenerate>`
:Ctrl-Shift-B:      :ref:`Bitmaps Available <elementmenu.Bitmaps>`
:Ctrl-C:            :ref:`Copy <editmenu.Copy>`
:Ctrl-Shift-C:      :ref:`Copy Fg to Bg <editmenu.CopyFg>`
:Alt-Ctrl-C:        :ref:`Copy Lookup Data <editmenu.CopyLookup>`
:Ctrl-D:            :ref:`Show/Hide Points <viewmenu.Points>`
:Ctrl-Shift-D:      :ref:`Correct Direction <elementmenu.Correct>`
:Ctrl-E:            :ref:`Find Problems <elementmenu.Problems>`
:Ctrl-Shift-E:      :ref:`Expand Stroke <elementmenu.Expand>`
:Ctrl-F:            :ref:`Fit in Window <viewmenu.Fit>`
:Ctrl-Shift-F:      :ref:`Font Info <elementmenu.Font>`
:Alt-Ctrl-F:        :doc:`Find / Replace </ui/dialogs/search>`
:Alt-Ctrl-Shift-F:  :ref:`Replace With Reference <editmenu.ReplaceRef>`
:Ctrl-G:            :ref:`Copy Reference <editmenu.Reference>`
:Ctrl-Shift-G:      :ref:`Generate Fonts <filemenu.Generate>`
:Alt-Ctrl-G:        :ref:`Generate Mac Family <filemenu.GenerateMac>`
:Ctrl-H:            :ref:`Open Outline <windowmenu.Outline>`
:Ctrl-Shift-H:      :ref:`AutoHint <hintsmenu.AutoHint>`
:Alt-Ctrl-H:        :ref:`Review Hints <hintsmenu.Review>`
:Ctrl-I:            :ref:`Get Info <elementmenu.Info>`
:Ctrl-Shift-I:      :ref:`Import <filemenu.Import>`
:Alt-Ctrl-Shift-I:  :ref:`Glyph Info <elementmenu.CharInfo>`
:Alt-Ctrl-I:        :ref:`Show Dependencies... <elementmenu.Dependents>`
:Ctrl-J:            :ref:`Open Bitmap <windowmenu.Bitmap>`
:Ctrl-Shift-J:      :ref:`Join <editmenu.Join>`
:Ctrl-K:            :ref:`Open Metrics <windowmenu.Metrics>`
:Ctrl-Shift-K:      :ref:`Auto Kern <autowidth.AutoKern>`
:Alt-Ctrl-Shift-K:  :ref:`Merge Feature Info <filemenu.Merge-feature>`
:Ctrl-L:            :ref:`Set LBearing <metricsmenu.LBearing>`
:Ctrl-Shift-L:      :ref:`Set Width <metricsmenu.Width>`
:Ctrl-M:            :ref:`Merge Point <editmenu.Merge>`
:Ctrl-Shift-M:      :ref:`Simplify <elementmenu.Simplify>`
:Alt-Ctrl-Shift-M:  :ref:`Simplify More <elementmenu.SimplifyMore>`
:Ctrl-N:            :ref:`New <filemenu.New>`
:Ctrl-O:            :ref:`Open <filemenu.Open>`
:Ctrl-Shift-O:      :ref:`Remove Overlap <elementmenu.Remove>`
:Ctrl-P:            :ref:`Print <filemenu.Print>`
:Alt-Ctrl-P:        :doc:`Display </ui/dialogs/display>`
:Ctrl-Q:            :ref:`Quit <filemenu.Quit>`
:Ctrl-Shift-Q:      :ref:`Close <filemenu.Close>`
:Ctrl-R:            :ref:`Set RBearing <metricsmenu.RBearing>`
:Ctrl-Shift-R:      :ref:`Revert File <filemenu.Revert>`
:Ctrl-Alt-R:        :ref:`Revert Glyph <filemenu.RevertGlyph>`
:Ctrl-S:            :ref:`Save <filemenu.Save>`
:Ctrl-Shift-S:      :ref:`Save As <filemenu.SaveAs>`
:Ctrl-T:            :ref:`AutoInstr <hintsmenu.AutoInstr>`
:Ctrl-Shift-T:      :ref:`AutoTrace <elementmenu.AutoTrace>`
:Ctrl-U:            :ref:`Unlink Reference <editmenu.Unlink>`
:Ctrl-V:            :ref:`Paste <editmenu.Paste>`
:Ctrl-Shift-V:      :ref:`Paste Into <editmenu.PasteInto>`
:Ctrl-W:            :ref:`Copy Width <editmenu.Width>`
:Ctrl-Shift-W:      :ref:`Auto Width <metricsmenu.Auto>`
:Ctrl-X:            :ref:`Cut <editmenu.Cut>`
:Ctrl-Shift-X:      :ref:`Add Extrema <elementmenu.Add-Extrema>`
:Ctrl-Y:            :ref:`Redo <editmenu.Redo>`
:Ctrl-Z:            :ref:`Undo <editmenu.Undo>`
:Ctrl-\\:           :ref:`Transform <elementmenu.Transform>`
:Ctrl-Shift-_:      :ref:`Round to Int <elementmenu.Round>`
:Ctrl-1:            :ref:`Make First <pointmenu.Make-First>`
:Alt-Ctrl-1:        :ref:`Invokes user script <filemenu.ScriptMenu>`
:Ctrl-2:            :ref:`24 pixel outline <viewmenu.px24>` :ref:`Curve Point <pointmenu.Curve>`
:Ctrl-Shift-@:      :ref:`Average Points <elementmenu.Average>`
:Alt-Ctrl-2:        :ref:`Invokes user script <filemenu.ScriptMenu>`
:Ctrl-3:            :ref:`36 pixel outline <viewmenu.px36>` :ref:`Corner Point <pointmenu.Corner>`
:Ctrl-Shift-#:      :ref:`Space Points <elementmenu.Space-Pts>`
:Alt-Ctrl-3:        :ref:`Invokes user script <filemenu.ScriptMenu>`
:Ctrl-4:            :ref:`48 pixel outline <viewmenu.px48>` :ref:`Tangent Point <pointmenu.Tangent>`
:Ctrl-5:            :ref:`Anti-Alias <viewmenu.AntiAlias>`
:Ctrl-Shift-%:      :ref:`32x8 cell window <viewmenu.32x8>`
:Ctrl-6:            :ref:`Fit To Em <viewmenu.FitToEm>`
:Ctrl-Shift-^:      :ref:`16x4 cell window <viewmenu.16x4>`
:Ctrl-7:            :ref:`72 pixel outline <viewmenu.px72>`
:Ctrl-Shift-*:      :ref:`8x2 cell window <viewmenu.8x2>`
:Ctrl-9:            :ref:`96 pixel outline <viewmenu.px96>`
:Ctrl-0:            :ref:`Add Anchor Point... <pointmenu.AddAnchor>`
:Ctrl-]:            :ref:`Next Glyph <viewmenu.Next>`
:Ctrl-Shift-}:      :ref:`Next Point <editmenu.NextP>`
:Ctrl-[:            :ref:`Prev Glyph <viewmenu.Prev>`
:Ctrl-Shift-{:      :ref:`Prev Point <editmenu.PrevP>`
:Ctrl-.:            :ref:`Execute Script <filemenu.Execute>`

                    :ref:`Select First Point <editmenu.FirstPt>`
:Ctrl-Shift->:      :ref:`Goto <viewmenu.Goto>`
:Alt-Ctrl-.:        :ref:`First Point, Next Contour <editmenu.NextContour>`
:Ctrl-,:            :ref:`Select Point At <editmenu.PointAt>`
:Ctrl-Shift-<:      :ref:`Find In Font View <viewmenu.FindInFV>`
:Alt-Ctrl-,:        :ref:`Points on Selected Contours <editmenu.Contours>`
:Escape:            :ref:`Deselect All <editmenu.Deselect>`
:Ctrl-Escape:       :ref:`Invert Selection <editmenu.Invert>`
:Backspace:         :ref:`Clear <editmenu.Clear>`
:Delete:            :ref:`Clear <editmenu.Clear>`
:Ctrl-=:            :ref:`Grid Fit Anti Alias <viewmenu.GFAntiAlias>`
:Ctrl-Shift-+:      :ref:`Bigger Pixel Size <viewmenu.Bigger>`

                    :ref:`Bigger Point Size <viewmenu.GFBigger>`
:Alt-Ctrl-Shift-+:  :ref:`Zoom In <viewmenu.In>`
:Ctrl--:            :ref:`Smaller Pixel Size <viewmenu.Smaller>`

                    :ref:`Smaller Point Size <viewmenu.GFSmaller>`
:Alt-Ctrl--:        :ref:`Zoom Out <viewmenu.Out>`
:Help:              :doc:`Help </ui/menus/helpmenu>`
:F1:                :doc:`Help </ui/menus/helpmenu>` -- :ref:`Index <helpmenu.Index>`


.. _HotKeys.Keyboards:

Different Keyboards
-------------------

The above descriptions assume you are using a keyboard for an IBM pc or
compatible. But different keyboard vendors label their keys differently and
different versions of X may map them differently.

I am aware of the following significant differences:

* On Mac OS/X the Option key is equivalent to the Alt modifier key
* On Suse PPC linux, the Command key is equivalent to the Alt modifier key

  (And the Option key acts as a compose key in the same way it does on the Mac
  when not using X)
* On Suns the meta (diamond) key is equivalent to the Alt modifier key.

FontForge will attempt to guess what keyboard you are using and produce menus
with hot-key indicators that match the host machine. If you are displaying on a
different machine from the one you are running on the menu names may be wrong.
You can fix this up with the :ref:`keyboard resource <xres.Keyboard>`, or the
-keyboard command line argument.


Tool modifiers in the Outline Glyph Window
------------------------------------------

Pointer
   :Shift: Constrain horizontal/vert or italic angle/45°
   :Alt: Select control points before normal points
   :Shift-Alt: Constrain control point motion to original angle from point
Magnify
   :Shift: When dragging a magnification area, make it square
   :Alt: Minify
Freehand
   :Shift: Constrain horizontal/vert/45°
Scroll
   :Shift: Constrain scroll either in single direction or by same amount in both directions
Add curve / Add corner / Add tangent
   :Shift: Constrain horizontal/vert/45° from last point
Pen
   :Shift: Constrain points h/v/45 from last point

           Constrain control points h/v/45 from point
Knife
   :Shift: Constrain horizontal/vert/45°
Ruler
   :Shift: Constrain measurement to one direction
   :Alt: Give current position more accurately
Scale
   :Shift: Constrain either to scale along x or y axis or scale both axes the same
Rotate
   :Shift: Constrain rotation to a multiple of 45°
Rect/eclipse
   :Shift: square/circle
Polygon/start
   :Shift: Constrains so that one of the vertices is horizontal/vertical/45°
Flip / Skew / Perspective / 3D rotate
   N/A


Modifier keys for arrow keys in the Outline Glyph Window
--------------------------------------------------------

:Ctrl / CapsLock:                Makes the arrow keys scroll
:Alt:                Makes the arrow keys move by ten times as much as they would otherwise

The menus
---------

* :doc:`File </ui/menus/filemenu>`
* :doc:`Edit </ui/menus/editmenu>`
* :doc:`Point </ui/menus/pointmenu>`
* :doc:`Element </ui/menus/elementmenu>`
* :doc:`Hints </ui/menus/hintsmenu>`
* :doc:`View </ui/menus/viewmenu>`
* :doc:`Metrics </ui/menus/metricsmenu>`
* :doc:`CID </ui/menus/cidmenu>`
* :doc:`MM </ui/menus/mmmenu>`
* :doc:`Window </ui/menus/windowmenu>`
* :doc:`Help </ui/menus/helpmenu>`
* :doc:`Hot Keys <HotKeys>`


.. _HotKeys.hotkeyassign:

Hotkeys
-------

FontForge lets you assign custom hotkeys to the menus and other actions. Default
hotkeys are provided for the menus in all windows which follow familiar key
assignments such as Control+O to open a file and Control+c to "copy" something.
The current hotkey for each menu item are shown in the menu itself to help you
learn existing bindings and see if your modification to the bindings are as you
expect.

The hotkey system allows you to customize the hotkey for anything that appears
in the menus. You can freely change the hotkey for a menu item or add one if you
find you are using a menu item frequently. Your settings for hotkeys are read
from and stored in the ~/.FontForge/hotkeys file. In it's most basic form this
file is a sequence of lines of the form action:key. A large default hotkeys file
is provided with FontForge in the hotkeys/default file.

The below fragment of ~/.FontForge/hotkeys will hopefully provide a nice example
to get you started creating your own hotkey bindings. As you can see the action
part starts with "CharView.Menu.", meaning that this action is to invoke a menu
on a specific window type. You can assign a different hotkey to the same menu
item in two different window types. For example, the glyph window might have
control+o to show font information, whereas the fontview might retain control+o
to mean open a font.

The first action in the below file, Point.Tools.Ruler, will invoke the Ruler
menu item which is in the Tools menu, which is itself in the Point top level
menu of the charview window (Glyph window). Notice that the key does not need to
have a qualifier such as control or alt. Having no modifier for a hotkey is
currently limited to the glyph window.

::

   CharView.Menu.Point.Tools.Ruler: r
   CharView.Menu.Point.Tools.Pointer: v
   CharView.Menu.View.Show.Tab.Tab0: Ctrl+1
   CharView.Menu.View.Show.Tab.Tab1: Ctrl+2
   CharView.Menu.View.Zoom in: Shift++
   CharView.Menu.View.Zoom in: z
   CharView.Menu.View.Zoom in: =
   CharView.Menu.Point.Tools.HVCurve: 1
   +CharView.Menu.Point.Tools.G2: 1

Continuing down the list you see the use of Ctrl+1 to select a specific tab in
the glyph window. This is followed by three key bindings, any of which will zoom
the display to a higher magnification level.

When reading hotkeys files at startup, FontForge will first load many system
defaults and then your ~/.FontForge/hotkeys file. Each file is processed from
the first line to the last line. When reading these hotkey files, it might be
the case that two or more lines have the exact same hotkey. For example, the
system default is Control+o to open a file. You might like to override that
hotkey to open the font info dialog instead. When FontForge is reading hotkeys
files, if a hotkey is encountered that is already in use, the current action for
that hotkey is replaced with the new action. So if you have the below line in
your ~/.FontForge/hotkeys file then Control+o will open the font info dialog
instead of trying to open a font. ::

   CharView.Menu.Element.Font Info...:Ctrl+o

If you want to add an action for a hotkey rather than replace the current
action, prefix the line with a "+" character as the Tools.G2 line does in the
above example. This allows the "1" key to invoke both the Tools.HVCurve and
Tools.G2 menu items. In this case only one menu will perform a task depending on
if spiro mode is active.

There are many modifiers that FontForge recognizes which are listed in the next
paragraph. These are always the English name for the modifier regardless of your
locale. The names are fully case insensitive; you can write Control, conTROL, or
control and they will have the same effect. The non modifier key, for example
's' without the quotes undergoes an internal case modification. If you specify
control+S this will be interpreted as control being held while the 's' key is
pressed. If you are wanting the Shift key to be held too, you need to explicitly
specify that as with control+shift+s as the key definition.

FontForge recognizes the following standard modifiers: Alt, Esc Ctl, Control,
Ctrl, Shft, Shift, CapsLock, Opt (the last corresponds to the Option key on the
mac keyboard, Cmd+ for the mac Command key Note: This can only be used by an X
program if the X11 application does not appropriate it -- this can be configured
in the X11 Preferences).

Other than the CharView window type, there are FontView and MetricsView.