简体   繁体   中英

How to increase font size of jqMath equation for Android app

So here's my code:

webView = (WebView) findViewById(R.id.layout_webview);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
String js = "<html><head>"
       + "<link rel='stylesheet' href='file:///android_asset/mathscribe/jqmath-0.4.0.css'>"
       + "<script src = 'file:///android_asset/mathscribe/jquery-1.4.3.min.js'></script>"
       + "<script src = 'file:///android_asset/mathscribe/jqmath-etc-0.4.2.min.js'></script>"
       + "</head><body>"
       + "<script>var s =   '$$x={-b±√{b^2-4ac}}/{2a}$$';M.parseMath(s);document.write(s);</script> </body>";
webView.loadDataWithBaseURL("", js, "text/html", "UTF-8", "");

Even though I set the fontsize to 100 the equation doesn't change in size at all no matter what number I set in the font size. Is there a way to increase the font size of the equation?

It is not clear where and when you set the font size to 100 (as it is not apparent in the code you posted).

According to this other answer you should set the font size after loading jqmath-xycss in order to override the values it contains.

Try setting it in the JavaScript after the code you posted. Something like document.body.style.fontSize = "100pt"; after your document.write for example.

 var s = '$$x={-b±√{b^2-4ac}}/{2a}$$'; M.parseMath(s); document.write(s); document.body.style.fontSize = "40pt"; 
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="http://mathscribe.com/mathscribe/jqmath-0.4.0.css" /> <script type="text/javascript" src="http://mathscribe.com/mathscribe/jqmath-etc-0.4.0.min.js"></script> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM