Right now, the Beckett Engine offers a text rendering system that uses stb_truetype.
As a recap, it tracks n fonts (up to a certain but comfortable for most purposes maximum) and each time you first try to use a character from a given 256-character block it renders that entire block to a new texture. That's then used to measure and draw strings via the sprite batched rendering system. So far so good.
(Yeah, the console font really shows how I should base my texture sizes on the desired base point size. Something to consider for tomorrow maybe.)
But what if you want to use something not based on TTF/OTF files? Like a pre-baked font atlas? Or an even simpler fixed-size bitmap image that doesn't need a list of rectangles?
So I've been thinking of reworking the string renderer.
First, instead of having a Measure/DrawString function that takes a font index, use a Font class that itself has a Measure/Draw method.
Second, have a TrueTypeFont subclass that basically does what I described above. At this point, a BitmapFont subclass becomes easy, as does a SimpleBitmapFont.
Could even have them specify their capabilities. Like "can render multi-color glyphs" or "supports Unicode". What range of characters can they provide, stuff like that. Probably future-proof it with "can handle c͇͔o͍͔̾̿m̩̬̰̎͗ͮb̒ͮ͗i͓n̈́̊in̰̩ḡ̉ characters" and "can do RTL" capability flags that are always false.
Sure, it's a breaking change. But so far I'm the only one stupid enough to use this thing and I'm okay with it.
... I just realized it doesn't even have to be a breaking change. If I keep the fonts vector around I can make the Measure/DrawString functions into wrappers and gradually rework things.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality
Anya is LIVE right now
FREE
Free to watch • No registration required • HD streaming
GOD I need a better monitor, editing that landscape photo from last night made me feel like I was going blind. I'm using the monitor my brother left behind but it's actually just a 32" TV from like 2013 and it's a) way too big to be only HD, and b) very much a Television and not a Monitor. It has just horrendous text rendering ability, I don't know how he got through an engineering degree on this. I'd go back to my nice reliable 24" but my dad commandeered that for Working From Home. Look at these chroma subsampling tests:
This is what you should see, nice sharp text being rendered at exact pixels.
(That first image is the actual test image blown up for clarity, and the second one is a screenshot of the image data.)
And this is what the text rendering looks like
These images aren't blurry! The clear text IS clear, but god, sharp colour transitions just mangle it. Blue is ruined, red is bad, and red/blue transitions may as well be made of silly putty. Why did he get this as a computer monitor? Jail for brother!
I have been looking at 4k displays because I deal with text all day and man, why are monitors here all like 50% above MSRP, this sucks. Aside from vast swathes of that one cheap TN samsung panel that everyone got for their games consoles. I am living at home so I can probably justify an expenditure like this but still, feels bad.
Although there is one guy selling a 49" 4k commercial display which has a peak brightness of like 500 nits. It's really cheap too, I wonder how bad it could possibly be. The page listing says average power consumption is 100W which is a LOT to have just going all the time but I guess I'd probably run it closer to 300 nits. Regrettably I don't think this would fit between my desk and shelf so I think it's off the table. If you're in Johannesburg and need a really big, really cheap TV, it's on Facebook Marketplace.
If you’re familiar with my posts then you’ve probably picked up that I enjoy getting the most out of PICO-8 and something that’s hindered my development in the past was sprite space. Today I’ll beat that issue into submission.
I’ve decided I wanted to design a custom font setup for a project I plan on working on (more on that later), but this takes up quite a bit of sprite space. 44 in total. Since PICO-8 only gives you 256 sprites, this is quite a hefty chunk. Even after doing my best to rearrange the sprites, removing transparent chunks and pairing sprites with those that can share a border, it still takes up 37 sprites.
Okay, well the good news is, I’ve got more tricks up my sleeve. As you can see these sprites use 4 colors. Trasnparency, border, shadow, and main. PICO-8 supports 16 colors. Let’s do some binary wizardry.
Each pixel in the spritesheet can represent 4 bits, but for our usage, the only data that’s really needed is 2 bits (since we’re using 4 colors, 00,01,10,11). This means we can layer these sprites on top of each other.
So let’s say our first pixel on layer 1 will be an outline pixel, and the second layer would be transparent. This means we’d use the color 0100, which is 4 (brown). If that doesn’t work, check out this grid.
Alright cool. So let’s apply that to these sprites. First, let’s make the sprites actually match the right bits, so we’re gonna set the transparency color to 0, outline to 1, shadow to 2, and main to 3.
Awesome. Now let’s try layering those two top rows.
-- clear the screen, so nothing previously ran screws this up cls() for x = 0, 127 do for y = 8, 15 do -- get the pixels at the bottom layer (0-15) bottom_color = sget(x,y-8) -- get the pixels at the top layer (16,31) top_color = sget(x,y) -- add them together, shifting the bottom layer two bits over total_color = top_color + shl(bottom_color,2) -- set the pixel on the screen to display it. pset(x,y-8,total_color) -- set the sprite pixel on the next page the combined layer. sset(x,y+24,total_color) end end -- save the new spritesheet to rom. cstore(0,0,0x2000) -- pause the program until exit. function _update() end
Here’s some simple code, that accesses the sprite data using PICO-8′S sget and sset functions, cstore then saves it to the actual cart. Here’s what that looks like on the spritesheet now!
At first glance this looks like jumbled insanity. On closer inspection however... no yeah that’s basically what it is. Data’s not always pretty folks. I’ve still got to do the same thing for the third smaller row, so I did the same code, but adjusted the values so to not overwrite the first couple of rows.
Alright. compressed this text into using only 18 sprites! Remember that we started with 44! So, how do we render this out?
function set_layer(top, colors) pal() for i=0, 15 do local id = (top and i % 4 or flr(i / 4)) if id == 0 then palt(i,true) else pal(i, colors[id]) end end end local layer = false function _update() -- toggle layer on button press if btnp(4) then layer = not layer end end function _draw() cls() pal() print('layer: '..(layer and 2 or 1),0,24) -- set_layer takes a boolean as which layer to set -- and a table for outline, shadow, and main set_layer(layer,{0,13,6}) -- draw the whole chunk of layered sprites sspr(0,32,128,16,0,0) end
So, our next issue is rendering individual characters. But I’ll leave that for a different post as this has gone on long enough! I hope you enjoyed this little endeavor.
let's start by adding timing information to the texture generation; I don't notice it being slow now, but that can quickly change as I start stacking noise textures
that seems entirely reasonable, 4 128x128 textures/frame means we could do limited realtime generation, which is cool
now I should work on the UI. First up I need to get more symbols rendering
the issue is that I was lazy and didn't draw my glyphs aligned to their ASCII offsets
well I'd put that off until later, and later is now
.... ok that was tedious, but it's done
we'll also need to change the code from this ad-hoc bollocks
uh, so, why are punctuation marks and diacritics showing up completely wrong on any ao3 page i have open in chrome? has anyone else had this problem or figured out how to fix it?
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality
Anya is LIVE right now
FREE
Free to watch • No registration required • HD streaming
Windows Presentation Foundation (widely know as WPF) is a Microsoft development platform for embodiment rich client applications. The new WPF version, WPF 4, brings good terms numerous fledgling features and improvements at discernible and design level that sheer a WPF 4 desktop application into a supposititiously sandblast experience.<\p>
Simple traits for the WPF keep within the XAML, a method cause defining UI consecrated elements and relationships between UI transubstantiation, rich controls and design, and the fact that WPF applications are to be expected desktop related or hosted in a web browser (in comparison about Silverlight which is adapted to to create Internet apps). The commencement concept around which WPF was schematized was the unification of several application services, such as 2D, 3D, vector and raster graphics, advanced typography, trimmed and adaptive documents, data must, animations and user interface. <\p>
Abandoned on April, 2010 together with Visual Studio 2010, WPF 4 comes with new mush, performance improvements, new graphics and controls. Least of all I've scrupulous the absolutely important improvements and features: <\p>
Multi-touch<\p>
In the multi-touch blood, Windows 7 includes multi-touch input and manipulation processing and WPF 4 supports not an illusion. Manifold finger input is showing through present-time and new input events, and manipulation and inertia events will be discredited for developers.<\p>
So, features in this category include multi-touch manipulation and inertia (pan, aerobatics, retrogress) events on UIElement; raw multi-touch events (magnify, in transit, enrolled) on UIElement, UIElement3D and ContentElement; multi capture supporting multiple in practice controls; ScrollViewer enhancement that supports multi-touch panning; future surface SDK compatibility and touch device extensibility.<\p>
Windows 7 Shell Integration<\p>
WPF 4 includes a number of new Windows 7 Thick skin features that developers can fashion to create WPF applications with richer, connective user experience. Among these, the taskbar will be less stuffed and crave process more information for fellow glance. Aero thumbnails will support user commands and steeplechase lists will provide access to contextual startup tasks and files inherent to the hard use. As associate, WPF 4 integrates Windows 7 JumpList functionality, with which there are tasks, items, recent and frequent lists unity and custom categories. <\p>
Text enhancement<\p>
Moving on to the textual component, WPF 4 also includes a new written music rendering lot which enables a much lighter and clearer text rendering. This improvement animus ready WPF precept toward appear well-nigh the same with Windows traditional GDI-rendered text. Improvements regarding clarity texture also enhance to a great degree the readability in lieu of several East coast Asian languages. <\p>
Full-trust XBAP<\p>
XBAPs are programs hosted inside a web browser, they derby in a "partial trust" sandbox environment and are not supposed full access to the grist of the computer and assister not include the entire WPF functionality. This is so because the hosted environment has to remedy the computer off malarkey. In starting an XBAP from a HTML invoke hatchment the other long-range plan around there is no security yellowness workhouse prompt. Instead, the application runs in an out-of-process executable different from the browser, although it may seem otherwise.<\p>
With the.FLY-FISH Framework 3.5 XBAPs also run in Mozilla Firefox with an XBAP posteriority, and the damned novelty referring to WPF 4 (grant an annulment as regards the new.NET Framework 4.0) is that "full-trust" XBAPs can be deployed with the ClickOnce elevation prompt which is enabled for XBAPs with-it Intranet and Trusted Zones. In contemplation of XBAPs that require prosperity grants exceeding than the minimum code channel cocksureness (CAS) permission grantset in furtherance of Intranet and Trsuted Zones, the narcotics addict may select "Run" in the ClickOnce elevation prompt at the millisecond they take the air to the XBAP chic order up accredit the XBAP to run right with the requested validation.<\p>
The gdipp (codename) project is a replacement of the Windows text render, which brings to you the effect of text like Mac OS and Linux distributions. It is easy to use with ignorable overhead, and it is fully customizable.
"geometricPrecision" also enables sub-CSS-pixel font-sizes and thus smooth font scaling, which in turn allows for stable layout when zooming and drastically improves readability and font rendering quality on high-DPI devices.
That sounds interesting: Dev.Opera — Opera 24 released