@@ -39,18 +39,18 @@ public static void initFonts()
3939 if ( m_latexFonts == null )
4040 {
4141 m_latexFonts = new List < LatexFont > ( ) ;
42- m_latexFonts . Add ( new LatexFont ( "Computer Modern Roman" , "cmr" ) ) ;
42+ // m_latexFonts.Add(new LatexFont("Computer Modern Roman", "cmr"));
4343 m_latexFonts . Add ( new LatexFont ( "Times Roman" , "ptm" ) ) ;
4444 m_latexFonts . Add ( new LatexFont ( "Palatino" , "ppl" ) ) ;
45- m_latexFonts . Add ( new LatexFont ( "NewCenturySchoolBook " , "pnc" ) ) ;
45+ m_latexFonts . Add ( new LatexFont ( "New Century Schoolbook " , "pnc" ) ) ;
4646 m_latexFonts . Add ( new LatexFont ( "Bookman" , "pbk" ) ) ;
47- m_latexFonts . Add ( new LatexFont ( "Computer Modern SansSerif" , "cmss" ) ) ;
47+ // m_latexFonts.Add(new LatexFont("Computer Modern SansSerif", "cmss"));
4848 m_latexFonts . Add ( new LatexFont ( "Helvetica" , "phv" ) ) ;
49- m_latexFonts . Add ( new LatexFont ( "AvantGarde " , "pag" ) ) ;
50- m_latexFonts . Add ( new LatexFont ( "Computer Modern Typewriter" , "cmtt" ) ) ;
49+ m_latexFonts . Add ( new LatexFont ( "Avant Garde " , "pag" ) ) ;
50+ // m_latexFonts.Add(new LatexFont("Computer Modern Typewriter", "cmtt"));
5151 m_latexFonts . Add ( new LatexFont ( "Courier" , "pcr" ) ) ;
52- m_latexFonts . Add ( new LatexFont ( "Computer Modern Fibonacci" , "cmfib" ) ) ;
53- m_latexFonts . Add ( new LatexFont ( "Computer Modern Dunhill" , "cmdh" ) ) ;
52+ // m_latexFonts.Add(new LatexFont("Computer Modern Fibonacci", "cmfib"));
53+ // m_latexFonts.Add(new LatexFont("Computer Modern Dunhill", "cmdh"));
5454 }
5555 if ( m_latexFontSeries == null )
5656 {
@@ -289,7 +289,7 @@ public static bool executeMikTex()
289289 return true ;
290290 }
291291
292- public static bool executeDviPng ( LatexEquation equation , bool usePreview , bool firstRun )
292+ public static bool executeDviPng ( LatexEquation equation , bool firstRun )
293293 {
294294 string appPath = AddinUtilities . getAppDataLocation ( ) ;
295295 Directory . SetCurrentDirectory ( appPath ) ;
@@ -325,73 +325,6 @@ public static bool executeDviPng(LatexEquation equation, bool usePreview, bool f
325325 if ( ! startProcess ( "cmd.exe" , "/c \" " + mgr . SettingsData . miktexPath + "\\ dvipng.exe\" -T tight -bg Transparent --depth --noghostscript -D " + dpiValue . ToString ( ) + " -o teximport.png teximport.dvi" , true , true , out output ) )
326326 return false ;
327327 }
328-
329- if ( usePreview )
330- {
331- try
332- {
333- System . Text . RegularExpressions . Match match = System . Text . RegularExpressions . Regex . Match ( output , @"depth=(\S*)]" ) ;
334- string depthStr = match . Groups [ 1 ] . Value ;
335- equation . m_offset = Int32 . Parse ( depthStr ) ;
336- }
337- catch
338- {
339- equation . m_offset = 0 ;
340- }
341- }
342- return true ;
343- }
344-
345- public static bool executeDviPng ( List < LatexEquation > equations )
346- {
347- string appPath = AddinUtilities . getAppDataLocation ( ) ;
348- Directory . SetCurrentDirectory ( appPath ) ;
349-
350- // Check Dpi
351- float [ ] systemDPI = AddinUtilities . getSystemDPI ( ) ;
352-
353- float dpiValue = 192 ;
354- foreach ( LatexEquation equation in equations )
355- {
356- float factor = equation . m_fontSize / 12.0f ;
357- float dpi = factor * systemDPI [ 0 ] ; // Multiply chosen dpi with factor
358- if ( dpi > dpiValue )
359- dpiValue = dpi ;
360- }
361-
362- SettingsManager mgr = SettingsManager . getCurrent ( ) ;
363- try
364- {
365- File . Delete ( appPath + "\\ teximport.png" ) ;
366- }
367- catch
368- {
369- MessageBox . Show ( "teximport.png could not be written. Permission denied." ) ;
370- return false ;
371- }
372-
373- string output = "" ;
374- if ( ! startProcess ( "cmd.exe" , "/c \" " + mgr . SettingsData . miktexPath + "\\ dvipng.exe\" -T tight -bg Transparent --depth --noghostscript -D " + dpiValue . ToString ( ) + " -o teximport%d.png teximport.dvi" , true , false , out output ) )
375- if ( ! startProcess ( "cmd.exe" , "/c \" " + mgr . SettingsData . miktexPath + "\\ dvipng.exe\" -T tight -bg Transparent --depth --noghostscript -D " + dpiValue . ToString ( ) + " -o teximport%d.png teximport.dvi" , true , true , out output ) )
376- return false ;
377-
378- try
379- {
380- System . Text . RegularExpressions . MatchCollection matches = System . Text . RegularExpressions . Regex . Matches ( output , @"depth=(\S*)\]" ) ;
381- if ( matches . Count == equations . Count )
382- {
383- LatexEquation [ ] eq = equations . ToArray ( ) ;
384- for ( int i = 0 ; i < equations . Count ; i ++ )
385- {
386- string depthStr = matches [ i ] . Groups [ 1 ] . Value ;
387- eq [ i ] . m_offset = Int32 . Parse ( depthStr ) ;
388- }
389- }
390- }
391- catch
392- {
393- //equation.m_offset = 0;
394- }
395328 return true ;
396329 }
397330
@@ -415,10 +348,7 @@ public static bool executeDviPs(LatexEquation equation)
415348 string output = "" ;
416349
417350 // run dvips
418- if ( ! startProcess ( "cmd.exe" , "/c \" " + mgr . SettingsData . miktexPath + "\\ dvips.exe\" teximport.dvi" , true , false , out output ) )
419- return false ;
420-
421- equation . m_offset = 0 ;
351+ startProcess ( "cmd.exe" , "/c \" " + mgr . SettingsData . miktexPath + "\\ dvips.exe\" teximport.dvi" , true , false , out output ) ;
422352
423353 return true ;
424354 }
@@ -433,7 +363,7 @@ public static bool createLatexPng(LatexEquation equation, bool usePreview, bool
433363 LatexFileGenerator . writeTexFile ( appPath + "\\ teximport.tex" , equation , usePreview ) ;
434364 if ( ! executeMikTex ( ) )
435365 return false ;
436- if ( ! executeDviPng ( equation , usePreview , firstRun ) )
366+ if ( ! executeDviPng ( equation , firstRun ) )
437367 return false ;
438368
439369 return true ;
0 commit comments