Search code examples
htmlcssfontsfont-facedoxygen

Font error: file not found with font-face


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');
}

Solution

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