Comments (4)
I'm going to try to fix the TTF font issue, using the Font.js library. This lets us measure font metrics for a given text at any size, which lets us cache metrics for individual characters, and render text to canvas directly with fillText, rather than as glyphs.
from love-webplayer.
awesome progress overall =) sorry i've been inactive, was away from home on a business trip.
ttf with canvas draw : hmm sounds like a potential performance bottleneck,
if it's not much effort a caching of the canvas for the same text would be good,
i suspect love loads the glyphs into a texture and blits from there or something,
rather than rendering the same text 30+ times per second using a ttf lib.
But not top priority i guess.
from love-webplayer.
Heh. After writing that, I figured out that fillText only works on 2D contexts. So while we can use it to populate textures, it's useless for directly rendering to the canvas. So the two different font types will share a common architecture after all.
They will differ a bit in that the TTF fonts will use an array of textures, and render characters to them as needed, striking a balance between preallocation and being able to add an arbitrary number of glyphs to the cache on demand. All the common code will be in cLoveFont, but thanks to the way Weblua supports handles, I'm able to do image fonts and TTF fonts separately as the cLoveImageFont and cLoveFontFace classes. This allows a nice, straightforward separation between common code, image-specific code, and fontface-specific code.
from love-webplayer.
Font.js turned out to be a bust, but I was able to get equivalent functionality from canvas.measureText. TTF fonts are now working with Weblua as demonstrated by the demo page. In case I haven't already made enough warnings about this, I seriously overhauled the entire love.font.js library. It's better but will probably take some getting used to.
from love-webplayer.
Related Issues (15)
- Pysfs HOT 4
- Single file / require HOT 1
- love.graphics.rotate doesnt work HOT 3
- Switch from existing Lua parser to Emscripten-based one HOT 10
- Get Clouds example to work with Weblua HOT 3
- Get IYFCT game working with Weblua HOT 1
- Port Hawkthorne to Weblua
- ReferenceError: MainOnLoad is not defined onload()
- how about pixijs + love? HOT 1
- Request: Integrate with Nextcloud & Owncloud
- love.thread with "web workers"
- love.image with 2d canvas contexts
- love.graphics.draw(bg) does not draw anything
- love.graphic.draw() not working exactly as it should. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from love-webplayer.