09 February 2019

## 2 实现方案

(x-display-pixel-height &optional FRAME)

Return the height in pixels of DISPLAY. The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame’s display.

On "multi-monitor" setups this refers to the pixel height for all physical monitors associated with DISPLAY. To get information for each physical monitor, use ‘display-monitor-attributes-list’.

(x-display-pixel-width &optional FRAME)

Return the width in pixels of DISPLAY. The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame’s display.

On "multi-monitor" setups this refers to the pixel width for all physical monitors associated with DISPLAY. To get information for each physical monitor, use ‘display-monitor-attributes-list’.

(add-to-list 'default-frame-alist
(cons 'top  (/ (x-display-pixel-height) 10)))
(cons 'left (/ (x-display-pixel-width) 10)))


(frame-char-height &optional FRAME)

Height in pixels of a line in the font in frame FRAME. If FRAME is omitted or nil, the selected frame is used. For a terminal frame, the value is always 1.

(frame-char-width &optional FRAME)

Width in pixels of characters in the font in frame FRAME. If FRAME is omitted or nil, the selected frame is used. On a graphical screen, the width is the standard width of the default font. For a terminal screen, the value is always 1.

(add-to-list 'default-frame-alist
(cons 'height (/ (* 4 (x-display-pixel-height))
(* 5 (frame-char-height)))))
(cons 'width (/ (* 4 (x-display-pixel-width))
(* 5 (frame-char-width)))))


(set-default-font "Inconsolata-14")

(if (not (eq window-system nil))
(progn
;; top, left ... must be integer
(cons 'top  (/ (x-display-pixel-height) 10)))
(cons 'left (/ (x-display-pixel-width) 10)))