Comments (2)
So this is also a bit a request for documentation. A separate file
would be nice, linked in from the main README. It's also ok
if this is outdated. Better to have outdated documentation than
no documentation.
from azul.
How difficult would this be to add for ruby, and what would be necessary?
You need to build a "C extension" for Ruby (or any other language). Azuls entire API is defined in a JSON file: https://github.com/fschutt/azul/blob/master/api.json
The JSON file describes the entire public API, data types and functions, including documentation. The Python binding code (and the C and C++ headers) are then auto-generated from the build.py file:
Lines 1200 to 1201 in e0bcb55
The build.py file itself generates a 20000-line python.rs
file: https://github.com/fschutt/azul/blob/master/azul-dll/src/python.rs. I am using PyO3 to generate the bindings for Python, you'd have to use something like Helix or raw Ruby-FFI. There are also guides for binding Ruby to Rust: https://www.cloudbees.com/blog/improving-ruby-performance-with-rust, but you just need to Google that. I recommend building a small hello-world extension first and testing that helix works.
The python extension bindings generate a lot of extra code, which is why they are behind a --feature=python-extension
feature-flag. Overall it should be relatively easy to generate the necessary Rust code, if you know how to parse a JSON file and output text to a file (with 20 years of experience, I think you should be able to handle that).
The only special thing with managed languages is how to pass function callbacks into Rust. For that, there are special "patches" to create a PyFunction
object here: https://github.com/fschutt/azul/tree/master/api/_patches/python, especially how to invoke python function objects from Rust, see the layout_callback.rs file. I just adapted the PyO3 examples: https://pyo3.rs/v0.14.5/python_from_rust.html. Same thing would have to be done for Ruby.
The CSS string is a feature of PyO3 (converting a Python String into a Rust String). Python creates the string object, passes it into a Rust function where it gets converted into a Rust String, then the CSS parser parses the string.
from azul.
Related Issues (20)
- If would like to split out text shaping what is the plan? HOT 3
- Cargo run error, could nto find IOReader in bincode
- couldn't read D:\soft\cargo/lib/azul-dll-0.0.1/target/release/azul.dll HOT 9
- Cannot compile Azul on M1 MacBook Pro due to older WInit dependency HOT 1
- License not updated on official website HOT 2
- Links broken on azul.rs HOT 6
- Build from crates.io command doesn't work HOT 1
- What's the deal with `extern "C"`? HOT 1
- Timers, Threads and Animations guide and after grade abnormal display HOT 1
- Error from link.exe HOT 1
- [Suggestion] Game example?
- It is not clear from the README whether azul supports Rust & C, Rust & C++ or Rust & C & C++ HOT 2
- [BUG] 404 error for azul.dll file HOT 3
- get rid of four year old xcb dependency HOT 1
- C header fails to parse with clang
- text_layout word_positions_to_inline_text_layout seems to loose words HOT 2
- azul.pyd not working on win7 and win11 HOT 1
- azul didn't create a window HOT 3
- Cannot compile `azul-text-layout` due using old version of freetype
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 azul.