PixarAnimationStudios / OpenUSD-proposals

Share and collaborate on proposals for the advancement of USD
92 stars 25 forks source link

Text proposal bitmap fonts? #53

Open meshula opened 1 month ago

meshula commented 1 month ago

on https://github.com/PixarAnimationStudios/OpenUSD-proposals/pull/48 :

bitmap fonts. sdf fonts take a while to generate at good quality, and people may wish to provide atlased fonts directly. I think we should explore a bitmapped atlassed font scheme, potentially as a schema. This would involve a texture reference for the atlassed font, coordinates into the atlas per glyph, basic metrical information, and a kerning table. There are a spectrum of use cases, ranging from elementary labeling to bidi multilingual annotations, and a variety of font technologies, and I think we should accommodate the fact that rendering text is not just the whole enchilada or nothing :)

PierreWang commented 1 month ago

I think the atlas font can be achieved using the text renderer plugin in our proposal. For example, a FontAtlasRenderer can have a big texture for each required font and put the characters in the texture (assume no CJK characters). When we are generating information for a text string, it will ask the FontAtlasRenderer to provide the texture coordinate for each character. The FontAtlasRenderer will put the required glyph into the big texture and return the coordinate for each character. Then in the usda file, we can specify the font name at the place of texture asset URI, such as "texttexture://Font:/Arial/Bold/True&Font:/Consolas&Font:/Calibri/Italic/True". The TextTextureResolver will know that there are three fonts, and it will ask the FontAtlasRenderer to provide the three textures for the fonts. The three textures can be put into a texture array. Then the texture array will be set as the texture resource of the shader.

meshula commented 1 month ago

I like the sound of that :)