Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: Include new fonts in Limesurvey

Include new fonts in Limesurvey 2 years 8 months ago #101875

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1790
  • Thank you received: 439
  • Karma: 110
I want to know which file I should edit...

Hi,
You have to edit related CSS rules the most of the time into template.css; Order fonts into "font-family" declarations (priority fonts first):
@font-face
{
font-family: MyCustomFont;
src: url('MyCustomFont.ttf'),
     url('MyCustomFont.eot'); /* for IE9 */
}
* {font-family:'MyCustomFont',Courier,System,Terminal,Consolas}
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
The administrator has disabled public write access.
The following user(s) said Thank You: OMdev

Include new fonts in Limesurvey 2 years 8 months ago #101887

  • OMdev
  • OMdev's Avatar
  • Offline
  • Platinum Lime
  • Posts: 326
  • Thank you received: 34
  • Karma: 15
Thank you Ben, you suggestion will work perfectly if my survey is in only one custum language. But my survey is in 4 languages each having custom font. My question is how can make each language custom font as priorty font when I run survey in that language. I dont want to hardcode any one font highest priority
Survey Designer and Programmer
"I always suggest to have a group by group display layout and create a seprate group for each question. This will be extra work but you will get flexiblity to create your question by using more than more lime survey question types."
The administrator has disabled public write access.

Include new fonts in Limesurvey 2 years 8 months ago #101896

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9254
  • Thank you received: 1319
  • Karma: 382
Hi,

You can use :lang() pseudo selector.

www.w3.org/International/questions/qa-css-lang
:lang(en) {font-family:'MyCustomFontEn',Courier,System,Terminal,Consolas}
:lang(fr) {font-family:'MyCustomFontFr',Courier,System,Terminal,Consolas}

Denis
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.
The following user(s) said Thank You: OMdev

Include new fonts in Limesurvey 2 years 8 months ago #101903

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1790
  • Thank you received: 439
  • Karma: 110
In addition of Denis's solution you can also:

1) Use the {LANG} keyword and add (startpage.pstpl) a link to an extra .CSS file, where you will just set or change the font-familly.
eg. <link rel='stylesheet' type='text/css' media='all' href='yourinstall.com/templates/yourtemplate/font_{LANG}.css' />


2) Change the font into the survey description field using jquery
<script type="text/javascript">
$(document).ready(function(){
$( "<style type='text/css'>"
+"* { font-family:MyCustomFont !IMPORTANT }"
+"</style>").appendTo( "head" );
});
</script>

(NOTE: it's not very W3C compliant but if you prefer you can directly insert a link to an additional stylesheet in the description field without use of javascript:
<link rel='stylesheet' type='text/css' media='all' href='yourinstall.com/templates/yourtemplate/MyCustomFont.css' />)
.
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
Last Edit: 2 years 8 months ago by Ben_V.
The administrator has disabled public write access.
The following user(s) said Thank You: OMdev
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.211 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form