otclient icon indicating copy to clipboard operation
otclient copied to clipboard

[Improvement] Refactoring font rendering

Open slavidodo opened this issue 5 years ago • 2 comments

OTClient supports only primitive font drawing. That is, there is no support for any font effect..

This should also be done using bitmap fonts as well since all the effects will rely on glyph sizes (i.e underlay, strikethough, ..)

This should also include multiple colors in the same text (without extending it by another label)..

Suggested effects to close this issue:

  • underlay
  • strike-through
  • outline
  • multiple colors (without using any widget extensions - aka phantom labels)

Suggested extra features that are useful:

  • text overflow (when text overflows the respected size, adding dots [...] or whatever.)

Tho, for the multiple colors, it should be optional to have phantom labels.. This is helpful or NPCs to allow the player to talk quickly by clicking the desired highlighted text.

slavidodo avatar Jun 29 '19 13:06 slavidodo

Adding support for underline, strike through and text collapsing should be rather trivial. As for multiple colors, the way the text vertex buffer is stored would have to be changed so that vertice for each glyph contain a pair of coordinates and color components rather than just coordinates, as for outline, it could probably be done efficiently with a shader.

diath avatar Nov 19 '19 14:11 diath

Multiple colors - the thing you are looking for is called color buffer and can be easily done with OpenGL:

https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glColorPointer.xml

Or with a fixed pipeline just glColor4f or so.

iryont avatar Jan 03 '20 22:01 iryont