Giter VIP home page Giter VIP logo

fontconfig-rs's People

Contributors

abonander avatar adrianwong avatar alokedesai avatar be-ing avatar brendanzab avatar emberian avatar jayvdb avatar l4l avatar manuel-rhdt avatar songww avatar wezm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fontconfig-rs's Issues

improve the Pattern::add_string ergonomics

I feel it would be nice to hide the CStr's from the API here:

pub fn add_string(&mut self, name: &CStr, val: &CStr)

and have a type for the different kinds of key values,
which could then be safely converted internally to an FcPattern.

I am imagining a safe type something like

pub enum PatternKeyValue =
    Family: &str,
    Style: &str,
    :
    Lang: &str,
    Charset: u32,
    :
    Variable: bool;
    :

Any thoughts?

how to get font name by FAMILY_LANG?

in some case, one font has many family name of each lang. I need get non-english FAMILY name, but use Pattern.get_string(FC_FULLNAME.as_cstr()), only one name will generate.

issue new release

wldash uses this lib and is broken on aarch64 because of this lib: kennylevinsen/wldash#42

It seems you have fixes, but they're not released. Can you tag and push a new release for crates.io users?

Thanks.

Improve Pattern::font_match(&mut self) -> Pattern ergonomics

The Pattern::font_match(&mut self) -> Pattern method borrows a Pattern and returns a owned Pattern making it very difficult to work with.

          let mut pat = Pattern::new(&fc);
          pat.add_string(FC_FAMILY.as_cstr(), &c_str);
          let pattern = pat.font_match();
                        ---------------- `pat` is borrowed here

/         return pattern;
|__________^ returns a value referencing data owned by the current function

I think it would be better if the old Pattern was moved like pub fn font_match(mut self) -> Pattern<'fc>.

use dlib for easier cross compiling

I'm trying to cross compile my application from x86-64 Linux to aarch64-unknown-linux-gnu to build it for my Pinephone and I am stumbling over Slint's dependency on fontconfig. I tried using an ARM64 container to cross compile, but using emulation with QEMU requires 2 hours to build! Slint currently uses the unsafe servo-fontconfig crate, so I opened an issue for that, but I think it would be better to improve this crate and switch Slint to using this.

The servo-fontconfig crate falls back to statically linking a vendored copy of libfontconfig if pkgconfig does not find it. This is problematic for two reasons. Most importantly, using a different copy of fontconfig than the system doesn't work as desired. Also, fontconfig requires a lot of C dependencies that need to be linked, which makes it difficult to get the vendored copy to build:

moire on ๎‚  main [$!] is ๐Ÿ“ฆ v0.1.0 via ๐Ÿฆ€ v1.58.1
โฏ pkg-config fontconfig --static --libs
-lfontconfig -lfreetype -lz -lbz2 -lpng16 -lm -lm -lz -lharfbuzz -lm -lglib-2.0 -lm -lpcre -lsysprof-capture-4 -pthread -lgraphite2 -lbrotlidec -lbrotlicommon -lxml2 -lz -llzma -lm

A solution to this would be using the dlib to let the user of the library either directly link fontconfig at build time or use dlopen to load it at runtime and remove the build time dependency. I recently helped implement this for the Rust JACK bindings and it makes cross compiling really easy. The Rust Wayland bindings use dlib as well and the X11 bindings have a similar option to use dlopen with the x11-dl crate.

consider moving away from the unmaintained const-cstr crate.

According to RUSTSEC-2023-0020 the const-cstr crate is abandoned and has soundness issues. It also performs a redundant null check every time a const_cstr is converted to a cstr, i'm not sure if the optimiser is smart enough to optimise away said check. The soundness issues seem pretty theoretical but still it seems like it would be a good idea to move away from said crate.

The cstr crate is able to construct real const cstrs with compile time checking, but unfortunately doing so requires at least rustc 1.64, i'm not sure what your MSRV policy is and whether that is appropriate. Alternatively you could use the unsafe function from_bytes_with_nul_unchecked directly which has been const since rustc 1.59.

Cross-Compile failed on Ubuntu20.04

Hi, there!

I recently used plotters in my project and I want to compile the project to x86_64-unknown-linux-musl on ubuntu20.04, then I met the error below

failed to run custom build command for `yeslogic-fontconfig-sys v3.2.0`

...
...pkg-config not configured for cross-compilation...
...

the fontconfig has been installed before compilation, but I can't find fontconfig-devel or fontconfig-dev on ubuntu.

May be someone can give me some tips?

Thanks!

Soundness issue

Pattern::print dereferences the user accessible raw pointer Pattern::pat.

This is unsound because a use could change Pattern::pat without unsafe code and call Pattern::print to cause UB.

License file missing in fontconfig crate

Hi, fedora use the source from crates.io to make package. it seem that the license is not include in the source of crates.io.

Having the file include in the crate source would ease packaging to not have to make a copy from github manually.

lib name conflict with servo/rust-fontconfig

Hi there,

I have recently identified a lib name conflict between this crate and https://github.com/servo/rust-fontconfig,

I opened a thread here https://users.rust-lang.org/t/dependencies-links-resolver-conflict/87801/4
to illustrate a cohabitation incompatibilities between 2 major crates in their domain.

In my opinion, the solution of less effort would be to synchronize with the other lib to rename one or the other and remove the conflict.

What do you think of that solution ?

Resolving this conflict can improve a lot the Rust crates ecosystem, so I have opened a similar issue on the servo/rust-fontconfig repo
=> servo/rust-fontconfig#44
Open to discussion :)
Kind regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.