-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Prevent fetching of segoe- and icon-font. #3024
Comments
Yes you can. It's a bit hidden but if you stick this on your page: window.FabricConfig = {
baseFontUrl: ''
}; This will bypass the font registration code, or redirect the base url for the fonts at another location. |
@dzearing I've tried that, but it still tries to fetch the Segoe Webfont. This function is called before mounting the application. export const setFabricDefaults = () => {
/* tslint:disable */
const win = window as any;
/* tslint:enable */
win.FabricConfig = {
fontBaseUrl: '',
};
}; Even though I'm not using the Segoe font in the application, the font seems to be loaded from the sharepointonline cdn whenever a button element is used (at least that's what my initial assumption is.). I wish there would be a way to set the default font in the theme, or similar. |
@utrolig You have to execute the |
That doesn't seem to work either, I tried putting it in a script tag at the top of the head section and it still loads the fonts, probably from css, because there are lots of references to the CDN in fabric.css. I'd like to be able to use the app offline and without the differently licensed fonts, because I am not developing directly for Office or SharePoint. |
Do not include the css if you just use the React package. The React Fabric package creates the class names dynamically. By importing the import { ColorClassNames, FontClassNames } from "@uifabric/styling";
const HugeSpan = () => (
<span className={`${FontClassNames.mega} ${ColorClassNames.themePrimary}`}>
I'm huge and blue (by default)!
</span>
); |
@Nimelrian Thanks, I removed fabric.css, but still getting the requests to CDN from somewhere. Guess I need to dig a little further ... |
Do you use |
No, but I just checked the code and it has to be "fontBaseUrl", not "baseFontUrl" as the first answer stated :) If I set this to "" in the script tag, I get no more requests to the CDN. Thanks for the help |
How do I replace the Icons for the dropdowns or DatePickers... For Button I successfully rendered fontawesomes icons in |
Use the |
No, |
Just checking in--are you still seeing this issue? #4206 has been merged which may help with this as well, at least for Windows users. |
@utrolig Has this been resolved or do we need additional investigation? |
@michaelangotti This has been resolved. Thank you. |
@stianbakken Glad to hear! I will close this issue. |
Bug Report
Describe the issue:
Is there any way to prevent fabric from trying to fetch the Fonts and IconFont from the sharepointonline CDN? I have replaced all the fonts and implemented a custom icon component that I use in all components, instead of using the iconfont provided by fabric-react.
Even though the icon font is not being used, I can still see it being fetched from the CDN.
The same thing happens for Segoe webfont.
The text was updated successfully, but these errors were encountered: