I want to use the fonts poppins and open-sans in doxygen, and am fairly new to CSS.
My font-face code for Open_Sans below.
#font-face {
font-family: 'Open_Sans';
src: url('fonts\Open_Sans\OpenSans-Regular.ttf') format('truetype');
}
My DIR structure has the fonts folder in the same folder as the css file.
DIR structure 1
Dir structure 2
I can click on my path and open the file in the VS Code editor, but when I open the webpage the console throws the error:
`net::ERR_FILE_NOT_FOUND'
From research I tried:
/fonts/
./fonts/
C:/complete-path/fonts/
with no success. I'm sorry if this question is redundant, but I can't seem to find a syntax error anywhere and am thinking it might have to do with doxygen.
EDIT
So I tried using an online open sans, and this threw no errors on the console, however it still did not work. You can verify to see the link works. I really think it has to do with doxygen at this point.
#font-face {
font-family: 'Open_Sans';
src: url('https://fonts.gstatic.com/s/opensans/v20/mem8YaGs126MiZpBA-UFWJ0bbck.woff2') format('woff2');
}
#font-face {
font-family: 'Open_Sans';
src: url('Open_Sans/OpenSans-Regular.ttf') format('truetype');
}
Remove "fonts/" from path.
Your CSS file inside the "fonts" folder, in your example the path becomes 'fonts/fonts/Open_Sans/OpenSans-Regular.ttf'
Ok, so I found the fix, but forgot to update.
Doxygen throws all files into the output directory when it is done, and will not put any files in there that you don't specify you need.
All you have to do is under the HTML_EXTRA_FILES tag in your doxyfile, specify the file(s) or directories you need, and it will place copies into the output dir.
In my case, it looks like this: HTML_EXTRA_FILES = fonts\Open_Sans\OpenSans-Regular.ttf
Just adding fonts\ would work as well. I am stil confused as to why the online url did not work, though.
Related
Icons are not showing after I put the HTML in the blade but are showing on the HTML Template. Since the files were under node_modules, knowing it would not make much of a difference I still tried using npm install. I have attached the CSS and Blade below followed by a screenshot of the output.
CSS
#font-face {
font-family: themify;
src: url({{ asset('admin_assets/icons/themify-icons/fonts/themify.eot#-fvbane') }});
src: url({{ asset('admin_assets/icons/themify-icons/fonts/themify.eot#') }})
format("embedded-opentype"),
url({{ asset('admin_assets/icons/themify-icons/fonts/themify.woff') }})
format("woff"),
url({{ asset('admin_assets/icons/themify-icons/fonts/themify.ttf') }})
format("truetype"),
url({{ asset('admin_assets/icons/themify-icons/fonts/themify.svg#-fvbane') }})
format("svg");
font-weight: 400;
font-style: normal;
}
I can't seen to understand where the problem is. I looked up on the internet and many places says I also have to use {{ asset('') }} in CSS files as well. But with or without, it made no difference.
In looking at your code above I am going make the following assumptions:
You are including the snippet above which defines your font class and the path to the assets in a blade template file within a block and it not compiled.
You are trying to access files that located most likely within the node_modules within your app using the asset('...') helper tag. (I am guessing something like node_modules/admin_assets/icons/themify-icons/fonts/ ....)
The issues as I would understand it given the assumptions above is that the helper tag asset() helper tag cannot access the node_modules in-line and the asset() serves relative from the public folder in your project.
With that being said you will either need to manually copy the files where you want in the public folder and call them. You can still use the helper tag.
Or, you can in your webpack.mix.js file using npm run dev to build it you can copy the files in your build from the node_modules folder with something like:
const mix = require('laravel-mix');
...
mix.copy('node_modules/admin_assets/icons/themify-icons/fonts', 'public/fonts');
...
https://laravel.com/docs/8.x/mix#copying-files-and-directories
https://laravel.com/docs/8.x/helpers#method-asset
I hope that helps and explains what is happening.
I am trying to upload a custom font to my site, but keep failing and I am not sure if I need to add routing in my server for it to work (I am using python flask).
The font is in static/fonts/Sofia_Handwritten.otf in my computer, before launching the server.
And the way I am trying to access it is:
#font-face {
font-family: "Sofia_Handwritten";
src: url("fonts/Sofia_Handwritten.otf");
}
#greeter {
font-size: 50px;
font-family: 'Sofia_Handwritten';
}
But no matter what the font doesn't display.
The server replies with 200, so it;s finding it just fine.
Edit:
The error was in the file itself.
The #font-face should be in your static/fonts/Sofia_Handwritten.css. After doing so, you go to your HTML and add something like this:
<link href="static/fonts/Sofia_Handwritten.css" rel="stylesheet">
and then you will be able to use your font.
I'm using metronic theme for building my web application. on each page this code is the first in the <head> tag:
<script>
WebFont.load({
google: {"families":["Poppins:300,400,500,600,700","Roboto:300,400,500,600,700"]},
active: function() {
sessionStorage.fonts = true;
}
});
</script>
I need to get those fonts from google so that I can use them locally OFFLINE. How Can I get them? What code Should I write instead. Thanks.
fist of al download the font and go to font generator Like : https://transfonter.org/ than you can download this file and placing according to the file
I had also the same problem but I solved it by the following steps:
1) As you may know, you can import google fonts by using googleapi, so first of all I maked appropriate url such as:
'https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700'
and
'https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700'
These urls should return a css file that contains source of fonts.
2) Save these files to the appropriate path.
3) You need to download source url in 'src' of 'font-face', one by one, and then put it to the appropriate path. For example on the following snipped css:
#font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 300;
src: local('Poppins Light'), local('Poppins-Light'), url(https://fonts.gstatic.com/s/poppins/v5/pxiByp8kv8JHgFVrLDz8Z11lFc-K.woff2) format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
You should download the font from the address:
'https://fonts.gstatic.com/s/poppins/v5/pxiByp8kv8JHgFVrLDz8Z11lFc-K.woff2'
4) Finally correct the 'url' of 'src' in the css file, according to the local font files.
Hope that it helps.
I was about to write a package's vignette using DOCCO linear style that is supported by knitr package (knitr).
In their example vignette there appears a nice graphic at the begging and at the end of HTML file.
But when I tried to maintain my own vignette those graphics didn't appear and instead of them there appear a huge 8 and h letter :P Like below:
.
Can any1 tell me why this is happening and maby how to fix this?
I am converting my vignette written in .Rmd to .HTML using this syntax:
Vignette:
<!--
%\VignetteEngine{knitr::docco_linear}
%\VignetteIndexEntry{The archivist package compedium}
-->
# The archivist package compedium
```{r}
summary(cars)
```
and function to convert this:
knitr::knit2html(input = "vignettes/archivist.Rmd",
output = "vignettes/archivist.md",
template = system.file("misc", "docco-template.html",
package = "knitr"))
Note that you should have npm installed on you computer.
Installing via terminal:
sudo apt-get install npm
and then installing docco:
sudo npm install -g docco
Thanks for any advice !
EDIT:
Firstly, after markdown compilation, I opened my vignette file under ubuntu's firefox on an Oracle Virtual Machine where it was created because I could not download and install docoo on a Windows. It appears with ugly 8 in output file.
But when I sent this file via e-mail to myself and opened it on a Windows it looked perfectly as I desired it when producing. Check below
And so, I opened knitr vignette manual explaining the docco style on a ubuntu on Virtual Machine in firefox and it appears it has the same 8 sign !
I think it must be some kind of encoding problem ? Am I right? Good it works and looks good after sending it to a Windows :P
Can any1 explain me this nonsense I lost most of my day on ?
Thanks :)
That content is added via CSS in the docco.css file. For the header image, they have
h1:after {
content: "8";
display: block;
font-family: "fleurons";
color: #999;
font-size: 80px;
padding: 10px 0 25px;
}
So they are inserting an "8" into the page after the header. But they have specified the font as "fleurons". This is a webfont they have also defined in the same css file.
#font-face {
font-family: 'fleurons';
src: url('public/fonts/fleurons.eot');
src: url('public/fonts/fleurons.eot?#iefix') format('embedded-opentype'),
url('public/fonts/fleurons.woff') format('woff'),
url('public/fonts/fleurons.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
So in order to get the "8" to look like the fancy symbol they have, you need to have this particular webfont available to your webpage. Same goes for the "h" at the end of the page as well.
I'm trying to use a custom font in my attempts to render a pdf from HTML.
I've tried it out in HTML, the font shows up, so the path to the font must be correct, and it's probably being used correctly. The font is of type .ttf, and according to the docs on http://xhtml2pdf-base.googlecode.com/hg/doc/xhtml2pdf-en.html, it should render, but it doesn't.
Here's what I have in my style tags:
#font-face {
font-family: "Swiss";
src: url("/static/font/swiss.ttf");
}
body {
font-family: "Swiss";
font-size: 12px;
}
And the html:
<body>
asdf
</body>
I've tried many things, stripping the quotes off the font url and font family, my body is wrapped inside HTML tags so the html is properly formatted. Everything renders fine when rendering in a web page, but it's not being rendered properly when converting to PDF. Can anyone help me spot the error?
Best way is to use a callback to fetch fonts using filesystem path. Is more accurate and also you wan't be hitting webserver for each resource (resource meaning, fonts, images, etc)
pisa.CreatePDF(html.encode("UTF-8"), file_object , encoding='UTF-8',
link_callback=fetch_resources)
def fetch_resources(uri, rel):
find_file_in_path_using_uri
return path
By the way, I think your problem is you haven't done collect static so fonts are not really at /static/font/swiss.ttf. I mean they are not there outside django, and xhtml2pdf it's outside django. I'm not 100% sure.
I have had the same problem. gdrimes was right. After changing the url from relative:
#font-face {
font-family: FreeSans;
src: url("./FreeSans.ttf");
}
to absolute
#font-face {
font-family: FreeSans;
src: url("/home/rok/Documents/Muzey/muzey/website/templates/pdf/FreeSans.ttf");
}
the font in my PDF document was updated.
I am late to this thread but I recently had the same problem. The suggestion to use a callback to provide the font definition does work (but in my case case had some limitations because I needed some logic to use different fonts depending on external conditions). However, I found that the problem was that the url("/static/font/swiss.ttf") needs to be an absolute file location, not relative to your application location, as is shown. For example, in my case, my application location was '/home/user/app' the url needs to be:
url("/home/user/app/static/font/swiss.ttf").