Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Use google font (Open Sans) without external link in ADF

3050772Jun 2 2017 — edited Jul 13 2017

Hi,

I am using Jdeveloper 11.1.1.7.0.

I need to use Open sans font with out using the external link(<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>) in my application.

I tried to achieve this using .woff2 files.

I have downloaded the .woff2 files and put it in my project and I used @font-face to use Open Sans font in my application.

/* cyrillic-ext */

@font-face {

font-family: 'Open Sans';

font-style: normal;

font-weight: 400;

src: local('Open Sans'), local('OpenSans'), url('../font/OpenSans01.woff2') format('woff2');

unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;

}

/* cyrillic */

@font-face {

font-family: 'Open Sans';

font-style: normal;

font-weight: 400;

src: local('Open Sans'), local('OpenSans'), url('../font/OpenSans02.woff2') format('woff2');

unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;

}

/* greek-ext */

@font-face {

font-family: 'Open Sans';

font-style: normal;

font-weight: 400;

src: local('Open Sans'), local('OpenSans'), url('../font/OpenSans03.woff2') format('woff2');

unicode-range: U+1F00-1FFF;

}

/* greek */

@font-face {

font-family: 'Open Sans';

font-style: normal;

font-weight: 400;

src: local('Open Sans'), local('OpenSans'), url('../font/OpenSans04.woff2') format('woff2');

unicode-range: U+0370-03FF;

}

/* vietnamese */

@font-face {

font-family: 'Open Sans';

font-style: normal;

font-weight: 400;

src: local('Open Sans'), local('OpenSans'), url('../font/OpenSans05.woff2') format('woff2');

unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;

}

/* latin-ext */

@font-face {

font-family: 'Open Sans';

font-style: normal;

font-weight: 400;

src: local('Open Sans'), local('OpenSans'), url('../font/OpenSans06.woff2') format('woff2');

unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;

}

/* latin */

@font-face {

font-family: 'Open Sans';

font-style: normal;

font-weight: 400;

src: local('Open Sans'), local('OpenSans'), url('../font/OpenSans07.woff2') format('woff2');

unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;

}

I am unable to achieve Open Sans font by using the code which I mentioned above.

where as I can able to achieve the fonts by using the absolute path(http://localhost/tfSample-ViewController-context-root/font/OpenSans01.woff2).

In my case I can't use absolute path and I need to use the relative path.

This is my folder structure.

pastedImage_0.png

I tried with url(../font/OpenSans01.woff2), url(font/OpenSans01.woff2). But it is not working.

Can any suggest me the url to use in this case?

Regards,

Selva.

This post has been answered by 3050772 on Jul 12 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 9 2017
Added on Jun 2 2017
5 comments
1,289 views