Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to render Base64 CSS Font. #153

Open
plamen-nikolov opened this issue Jan 24, 2014 · 2 comments · May be fixed by #740
Open

Unable to render Base64 CSS Font. #153

plamen-nikolov opened this issue Jan 24, 2014 · 2 comments · May be fixed by #740
Labels
feature request New feature or request fonts Issues with rendering fonts

Comments

@plamen-nikolov
Copy link

I am trying to embed base64 font in my HTML, but the library can load it. I made some research and found that in file util.py:519 there is a condition that checks if the uri starts with "data:", but the passed uri is a list, that is evaluated to str, so the string is "[u'data:..'" and the if can match it. I tried couple of tricky things, but after the match another errors came out. So, can you help me guys to fix this issue? Thanks a lot!

# Data URI
        if uri.startswith("data:"): # uri="[u'data:....']"
            m = _rx_datauri.match(uri)
            self.mimetype = m.group("mime")
            self.data = base64.decodestring(m.group("data"))

That is how my html file looks like:

@font-face {
                font-family: "Trebuchet MS";
                font-style: normal;
                font-weight: normal;
                src: url(data:font/truetype;base64,AAEA......) format('truetype');
}
@benjaoming benjaoming added the feature request New feature or request label May 2, 2016
@ho9science
Copy link

your os don't have type 'font/ttf', add mime type in os

@luisza luisza added the fonts Issues with rendering fonts label Sep 16, 2020
@jhahn3
Copy link

jhahn3 commented Feb 14, 2023

I am also attempting to use the font face with base 64 true type. I have followed the above from plamen-nikolov and am getting an error:

@font-face{
font-family: burton;
src: url('data:font/truetype;charset=utf-8;base64,<>') format('truetype');
}

ERROR: Extract data form data: in tag

I have tried many different iterations of this, but am not having any luck. Can someone please help?

@vladimir-g vladimir-g linked a pull request Nov 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request fonts Issues with rendering fonts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants