[wesnoth-commits] [wesnoth/wesnoth] 8cd739: font/sdl_ttf_compat: Initial Pango-based font rend...

Iris Morelle noreply at github.com
Sat Mar 13 16:52:03 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 8cd739cef1fab269262bffc79bf08c10b72460c8
      https://github.com/wesnoth/wesnoth/commit/8cd739cef1fab269262bffc79bf08c10b72460c8
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M source_lists/libwesnoth
    A src/font/sdl_ttf_compat.cpp
    A src/font/sdl_ttf_compat.hpp

  Log Message:
  -----------
  font/sdl_ttf_compat: Initial Pango-based font rendering API for GUI1

This adds a minimal wrapper around pango_text intended for use in GUI1,
in particular for the help browser. Functionality is very incomplete
right now but for the time being we can render text, determine line
dimensions, and ellipsize text, which is almost the bare minimum needed
for porting the Help system (it's still missing a word wrapping
implementation).


  Commit: 4bb412c56d70b87ba3e70a34d2d77a99ce8e4295
      https://github.com/wesnoth/wesnoth/commit/4bb412c56d70b87ba3e70a34d2d77a99ce8e4295
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/help/help_text_area.cpp

  Log Message:
  -----------
  help: Use Pango for most functionality

We're still using SDL_ttf-based word wrapping, which we need to replace
with something that uses Pango instead.


  Commit: 07af824c2b3b24862441aea3fb74913aa0d6b2f8
      https://github.com/wesnoth/wesnoth/commit/07af824c2b3b24862441aea3fb74913aa0d6b2f8
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/sdl_ttf_compat.cpp

  Log Message:
  -----------
  font/sdl_ttf_compat: Use a single private renderer

It's not the same renderer globally used for everything else to avoid
any potential issues with state not being cleared or whatever.


  Commit: b58dbb59db44cf8e7340729dab90c0fbb2584c01
      https://github.com/wesnoth/wesnoth/commit/b58dbb59db44cf8e7340729dab90c0fbb2584c01
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/sdl_ttf_compat.cpp
    M src/font/sdl_ttf_compat.hpp
    M src/font/text.cpp
    M src/font/text.hpp

  Log Message:
  -----------
  font/sdl_ttf_compat: Add a Pango-based word wrap implementation

This lets Pango do all of the work for us and pulls the text back from
the renderer. It shouldn't be much more expensive than it needs to be --
the only real expensive step is copying the characters back into a list
of strings, and it's not by much.

Note: I haven't quite figured out what the partial_line parameter does
or what to do about it. It's probably not trivial to implement since it
seems to involve the decision of whether to break a line within word
boundaries or not.


  Commit: a7015a9c954c01c9810a36538675f10881444e33
      https://github.com/wesnoth/wesnoth/commit/a7015a9c954c01c9810a36538675f10881444e33
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/help/help_impl.cpp

  Log Message:
  -----------
  help: Use Pango word wrap implementation instead of SDL_ttf


  Commit: fbf7d055f22ef0a3c8ae4756ddc9e41eadaaa1a1
      https://github.com/wesnoth/wesnoth/commit/fbf7d055f22ef0a3c8ae4756ddc9e41eadaaa1a1
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/sdl_ttf_compat.cpp
    M src/font/sdl_ttf_compat.hpp

  Log Message:
  -----------
  font/sdl_ttf_compat: Implement draw_text() substitute

This doesn't support GUI1 markup, intentionally.


  Commit: 00c031d782279e7fae7f429c2ff7be15781737c2
      https://github.com/wesnoth/wesnoth/commit/00c031d782279e7fae7f429c2ff7be15781737c2
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/display.cpp
    M src/editor/palette/location_palette.cpp
    M src/show_dialog.cpp
    M src/widgets/button.cpp
    M src/widgets/menu.cpp
    M src/widgets/textbox.cpp

  Log Message:
  -----------
  gui1: Use font::pango_draw_text()


  Commit: 1898c0e3d25e1cade16686af3157ec046c45ddc7
      https://github.com/wesnoth/wesnoth/commit/1898c0e3d25e1cade16686af3157ec046c45ddc7
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/sdl_ttf_compat.cpp
    M src/font/sdl_ttf_compat.hpp

  Log Message:
  -----------
  font/sdl_ttf_compat: Implement text_area() substitute

Again, no GUI1 markup here.


  Commit: d1f026d22b9d0a989e72d1b0c31ac25fe6def8c8
      https://github.com/wesnoth/wesnoth/commit/d1f026d22b9d0a989e72d1b0c31ac25fe6def8c8
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/display_chat_manager.cpp
    M src/widgets/button.cpp
    M src/widgets/menu.cpp

  Log Message:
  -----------
  gui1: Move more code to using the compatibility API


  Commit: ec94da31b51d175845aeca49d0a4e26384aee9dc
      https://github.com/wesnoth/wesnoth/commit/ec94da31b51d175845aeca49d0a4e26384aee9dc
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/sdl_ttf.cpp

  Log Message:
  -----------
  font: Drop more GUI1 markup support


  Commit: ffffd073bfff6518f73943c7bf285a0b1ec99e27
      https://github.com/wesnoth/wesnoth/commit/ffffd073bfff6518f73943c7bf285a0b1ec99e27
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/marked-up_text.cpp
    M src/font/marked-up_text.hpp

  Log Message:
  -----------
  font: Drop some code paths that have already been transitioned

This impacts font::draw_text(), font::text_area(),
font::word_wrap_text().


  Commit: a44c185333f3b89101a92aba7fc964ff3a6358b8
      https://github.com/wesnoth/wesnoth/commit/a44c185333f3b89101a92aba7fc964ff3a6358b8
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/sdl_ttf_compat.hpp

  Log Message:
  -----------
  font: Set a default function parameter


  Commit: 0024cfa7e42fedd9af3128dba0b11cd9f6b51728
      https://github.com/wesnoth/wesnoth/commit/0024cfa7e42fedd9af3128dba0b11cd9f6b51728
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/help/help_impl.cpp
    M src/help/help_topic_generators.cpp
    M src/video.cpp
    M src/widgets/textbox.cpp

  Log Message:
  -----------
  gui1: Use font::pango_line_width() in more places

The SDL_ttf version is still in use in the SDL_ttf API itself.


  Commit: 66659e03f851960ae8b3ab85fa5ddc051577cbeb
      https://github.com/wesnoth/wesnoth/commit/66659e03f851960ae8b3ab85fa5ddc051577cbeb
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/sdl_ttf.cpp
    M src/font/sdl_ttf.hpp
    M src/font/text.cpp
    M src/font/text.hpp

  Log Message:
  -----------
  font: Reimplement font::get_max_height() using Pango

A few caveats:

 * This implementation allows configuring the font family class and
   style to select the correct font for any given context. The default
   values are equivalent to what was being done in the SDL_ttf-based
   version, but not future-proof. Users like the GUI2 textbox should
   make use of the new optional parameters to select a more relevant
   font going forward (not part of this commit).

 * Pango has a line height metric, equivalent to SDL_ttf's
   TTF_FontLineSkip(). However, this is not what we want here -- the
   ascender + descender formula is intended to give us a neat box where
   the tallest glyph can fit, not the minimum distance between
   baselines. This is important for the GUI2 textbox in particular.

 * The internal implementation uses the default text renderer and sets
   relevant parameters. This should not introduce new issues, but if it
   does then that means someone is not resetting the renderer properly
   before using it.

This notably rids GUI2 of its one known dependency on SDL_ttf.


  Commit: 3fb36ee22ddd71ff451c77867f94da3bbe6bdaf8
      https://github.com/wesnoth/wesnoth/commit/3fb36ee22ddd71ff451c77867f94da3bbe6bdaf8
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/sdl_ttf_compat.hpp

  Log Message:
  -----------
  font: Make font_style optional in pango_render_text/line_size()


  Commit: c42506ad2b0d6aed7fb38e61a507379963b96e3f
      https://github.com/wesnoth/wesnoth/commit/c42506ad2b0d6aed7fb38e61a507379963b96e3f
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/display.cpp
    M src/widgets/textbox.cpp

  Log Message:
  -----------
  font: Use pango_render_text() instead of get_rendered_text()


  Commit: c17e6c00df37d033c8664c30610610cee1fad017
      https://github.com/wesnoth/wesnoth/commit/c17e6c00df37d033c8664c30610610cee1fad017
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/marked-up_text.cpp

  Log Message:
  -----------
  font: Drop SDL_ttf dependency in font::parse_markup()

GUI1 markup isn't being used anymore anyway. This function is only
allowed to remain for a little bit longer as an implementation detail.


  Commit: 8a9e861eb3ed85e7b7d6c758d7435b772a928386
      https://github.com/wesnoth/wesnoth/commit/8a9e861eb3ed85e7b7d6c758d7435b772a928386
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/build_info.cpp
    M src/build_info.hpp

  Log Message:
  -----------
  bi: Remove tracking of SDL_ttf and FriBidi


  Commit: 2dfdc0061d400ffad39f974d7fe9348204af0d08
      https://github.com/wesnoth/wesnoth/commit/2dfdc0061d400ffad39f974d7fe9348204af0d08
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M CMakeLists.txt
    M SConstruct
    M source_lists/libwesnoth
    M src/CMakeLists.txt
    M src/display.cpp
    M src/font/font_config.cpp
    M src/font/font_config.hpp
    R src/font/font_id.hpp
    R src/font/sdl_ttf.cpp
    R src/font/sdl_ttf.hpp
    R src/font/text_cache.cpp
    R src/font/text_cache.hpp
    R src/font/text_surface.cpp
    R src/font/text_surface.hpp
    M src/gui/widgets/text_box.cpp
    M src/help/help_impl.hpp
    M src/help/help_text_area.cpp
    M src/help/help_topic_generators.cpp
    M src/show_dialog.cpp
    M src/widgets/button.cpp
    M src/widgets/menu.cpp
    M src/widgets/textbox.cpp

  Log Message:
  -----------
  Remove SDL_ttf wrapper API

This removes the build-time dependencies on SDL_ttf and FriBidi,
alongside the SDL_ttf wrappers, the SDL_ttf text surface class, the
SDL_ttf render cache, and the SDL_ttf (de)initialization code.


  Commit: 1c40a0271e3b9847ca666ba68a5d53d88e4eb63d
      https://github.com/wesnoth/wesnoth/commit/1c40a0271e3b9847ca666ba68a5d53d88e4eb63d
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M utils/dockerbuilds/CI/Dockerfile-base-2004-master
    M utils/dockerbuilds/CI/Dockerfile-base-mingw

  Log Message:
  -----------
  ci: Remove dependencies on SDL_ttf and FriBidi


  Commit: 196db7b413acdd60be4d634ccf5ff0667c4fc302
      https://github.com/wesnoth/wesnoth/commit/196db7b413acdd60be4d634ccf5ff0667c4fc302
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M INSTALL.md
    M projectfiles/VC16/README.md

  Log Message:
  -----------
  Remove SDL_ttf and FriBidi mentions from INSTALL.md and the VS Readme

[ci skip]


  Commit: 066136af81d4c334ec387befb807393ad77b5c44
      https://github.com/wesnoth/wesnoth/commit/066136af81d4c334ec387befb807393ad77b5c44
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/marked-up_text.cpp
    M src/font/marked-up_text.hpp

  Log Message:
  -----------
  font: Remove a few more orphaned markup-related code paths

These were used by the GUI1 markup-supporting render APIs, and the
homebrew line wrapping implementation.


  Commit: 5ce799ddbd0e5cbc09d3758217aeffc0de62df74
      https://github.com/wesnoth/wesnoth/commit/5ce799ddbd0e5cbc09d3758217aeffc0de62df74
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/widgets/menu.cpp
    M src/widgets/menu.hpp

  Log Message:
  -----------
  gui1: Remove unit level and xp sorters

This functionality is entirely unused in 1.14 and later because GUI1
menus aren't used to list units anymore.

(Strictly speaking, all sorters are unused right now.)


  Commit: c5e1f77e80ef2c9b08b47a6412c336bff4a87c22
      https://github.com/wesnoth/wesnoth/commit/c5e1f77e80ef2c9b08b47a6412c336bff4a87c22
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M src/font/marked-up_text.cpp
    M src/font/marked-up_text.hpp
    M src/widgets/menu.cpp

  Log Message:
  -----------
  gui1: Drop last instances of GUI1 markup support in menu widgets


  Commit: 055eb13e67ab9dd9b3d52e0964f382f885f19294
      https://github.com/wesnoth/wesnoth/commit/055eb13e67ab9dd9b3d52e0964f382f885f19294
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M source_lists/libwesnoth
    M src/display.cpp
    M src/display_chat_manager.cpp
    M src/editor/palette/location_palette.cpp
    R src/font/marked-up_text.cpp
    R src/font/marked-up_text.hpp
    M src/help/help_impl.cpp
    M src/show_dialog.cpp
    M src/widgets/button.cpp
    M src/widgets/menu.cpp

  Log Message:
  -----------
  Move font::is_cjk_char() to help browser implementation


  Commit: 56e6d0344f5faa7576a5fab30fec2a28d11aa28b
      https://github.com/wesnoth/wesnoth/commit/56e6d0344f5faa7576a5fab30fec2a28d11aa28b
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-03-13 (Sat, 13 Mar 2021)

  Changed paths:
    M projectfiles/VC16/wesnoth.vcxproj
    M projectfiles/VC16/wesnoth.vcxproj.filters

  Log Message:
  -----------
  Update VS project files


Compare: https://github.com/wesnoth/wesnoth/compare/39d75333c0f7...56e6d0344f5f



More information about the Commits mailing list