kkartaltepe / obs-text-pango

Text Source using Pango for OBS Studio
GNU General Public License v2.0
49 stars 16 forks source link

Some UTF-8 files render incorrectly, or do not render #17

Closed matoi974 closed 3 years ago

matoi974 commented 3 years ago

I use a plugin for foobar2000 to output the title of the currently playing track from foobar2000 to a file, presumably encoded in UTF-8 (65001), and sometimes obs-text-pango doesn't render the text correctly (or at all).

STR:

  1. Download and extract example files: text-pango-sample-files.zip
  2. Create a new Text (Pango) source, tick "read from file", select one of the files

Expected result: All text rendered correctly

Actual result: With some text files, the last character or multiple last characters wouldn't be rendered. Some text files would fail to render completely, and the plugin would throw errors in the obs-studio log.

Additional information: Reproduced on Windows 7 SP1 and Windows 20 2004, both 64bit, using a pre-release version of obs-studio. Same issues reproduce identically on release versions. All of this text was rendered correctly by the inbuilt Text(GDI+) plugin, and incorrectly by the inbuilt Text(Treetype 2) plugin. Enabling Chat Log mode fixes all of the cut-off text issues, but the issue of not rendering anything remains present. obs-studio log: 2021-07-05 02-50-53.txt

kkartaltepe commented 3 years ago

Thanks, it looks like they were all due to a mistake in BOM handling. They all appear to render correctly on master now.

screen_20210704151840

--- edit

As a workaround you can use chatlog mode with some number of lines to render these files on the existing version. The bom handling mistake was not in that code path.

matoi974 commented 3 years ago

Oh, I forgot to mention: at certain font sizes, text still fails to render. Example below renders with Open Sans 226pt, but fails at 236pt. Text file: NowPlayingSimple.txt Log: 2021-07-05 03-25-58.txt

image

kkartaltepe commented 3 years ago

We dont truncate text that is too wide to be rendered as a single texture (16k pixels) (but we do when its too long). When you are using font sizes upwards of 200pt pixels that is usually only a couple dozen characters or less. If you need more characters id recommend using a smaller font size, we may improve this later.

Please see #11 (though the limit was increased to 16k)

kkartaltepe commented 3 years ago

and make sure you are on the latest version or you will be limited to only 4k pixels https://github.com/kkartaltepe/obs-text-pango/releases/tag/v0.4.1