def _nvim_resize(self, columns, rows):
da = self._drawing_area
# create FontDescription object for the selected font/size
font_str = '{0} {1}'.format(self._font_name, self._font_size)
self._font, pixels, normal_width, bold_width = _parse_font(font_str)
# calculate the letter_spacing required to make bold have the same
# width as normal
self._bold_spacing = normal_width - bold_width
cell_pixel_width, cell_pixel_height = pixels
# calculate the total pixel width/height of the drawing area
pixel_width = cell_pixel_width * columns
pixel_height = cell_pixel_height * rows
gdkwin = da.get_window()
content = cairo.CONTENT_COLOR
self._cairo_surface = gdkwin.create_similar_surface(content,
pixel_width,
pixel_height)
self._cairo_context = cairo.Context(self._cairo_surface)
self._pango_layout = PangoCairo.create_layout(self._cairo_context)
self._pango_layout.set_alignment(Pango.Alignment.LEFT)
self._pango_layout.set_font_description(self._font)
self._pixel_width, self._pixel_height = pixel_width, pixel_height
self._cell_pixel_width = cell_pixel_width
self._cell_pixel_height = cell_pixel_height
self._screen = Screen(columns, rows)
self._window.resize(pixel_width, pixel_height)
评论列表
文章目录