Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/
obj/
28 changes: 28 additions & 0 deletions AddinUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ public static void initFonts()
m_latexFontShapes.Add(new LatexFontShape("Slanted", "sl"));
m_latexFontShapes.Add(new LatexFontShape("Small caps", "sc"));
}
if (m_latexMathFonts == null)
{
m_latexMathFonts = new List<LatexMathFont>();
m_latexMathFonts.Add(new LatexMathFont("Standard", ""));
m_latexMathFonts.Add(new LatexMathFont("Palatino", "mathpazo"));
m_latexMathFonts.Add(new LatexMathFont("Sans Math", "sansmathfonts"));
m_latexMathFonts.Add(new LatexMathFont("CM Bright", "cmbright"));
m_latexMathFonts.Add(new LatexMathFont("Times", "mathptmx"));
m_latexMathFonts.Add(new LatexMathFont("Fourier", "fourier"));
m_latexMathFonts.Add(new LatexMathFont("Euler", "eulervm"));
}
}

private static List<LatexMathFont> m_latexMathFonts = null;
public static List<LatexMathFont> LatexMathFonts
{
get { return m_latexMathFonts; }
set { m_latexMathFonts = value; }
}

public static LatexFont getLatexFont(string name)
Expand Down Expand Up @@ -96,6 +114,16 @@ public static LatexFontShape getLatexFontShape(string name)
return null;
}

public static LatexMathFont getLatexMathFont(string name)
{
foreach (LatexMathFont f in m_latexMathFonts)
{
if (f.fontName == name)
return f;
}
return null;
}

public static Color stringToColor(string colorText)
{
if (colorText == null)
Expand Down
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.0.2
- Allow selection of math font through GUI

1.0.1
- Convert text to curves before import

Expand Down
39 changes: 37 additions & 2 deletions LatexDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public string FontShape
get { return comboBoxShape.Text; }
}

public string MathFont
{
get { return comboBoxMathFont.Text; }
}

public string LatexCode
{
get { return m_scintilla.Text; }
Expand Down Expand Up @@ -113,6 +118,7 @@ private void init(string title)
comboBoxFont.Text = mgr.SettingsData.font;
comboBoxSeries.Text = mgr.SettingsData.fontSeries;
comboBoxShape.Text = mgr.SettingsData.fontShape;
comboBoxMathFont.Text = mgr.SettingsData.mathFont;
buttonColor.BackColor = AddinUtilities.stringToColor(mgr.SettingsData.textColor);
m_textColor = mgr.SettingsData.textColor;
pictureBoxPreview.BackColor = Color.White;
Expand All @@ -131,6 +137,7 @@ public void init(LatexEquation eq, string title)
comboBoxFont.Text = eq.m_font.fontName;
comboBoxSeries.Text = eq.m_fontSeries.fontSeries;
comboBoxShape.Text = eq.m_fontShape.fontShape;
comboBoxMathFont.Text = eq.m_mathFont.fontName;

try
{
Expand Down Expand Up @@ -166,6 +173,7 @@ private void createFontEntries()
comboBoxFont.Items.AddRange(AddinUtilities.LatexFonts.ToArray());
comboBoxSeries.Items.AddRange(AddinUtilities.LatexFontSeries.ToArray());
comboBoxShape.Items.AddRange(AddinUtilities.LatexFontShapes.ToArray());
comboBoxMathFont.Items.AddRange(AddinUtilities.LatexMathFonts.ToArray());
}

void LatexDialog_FormClosing(object sender, FormClosingEventArgs e)
Expand Down Expand Up @@ -221,12 +229,14 @@ private bool generateEquation(bool createShape)
mgr.SettingsData.font = comboBoxFont.Text;
mgr.SettingsData.fontSeries = comboBoxSeries.Text;
mgr.SettingsData.fontShape = comboBoxShape.Text;
mgr.SettingsData.mathFont = comboBoxMathFont.Text;
mgr.SettingsData.textColor = m_textColor;
mgr.saveSettings();

m_latexEquation = new LatexEquation(m_scintilla.Text, size, m_textColor, (LatexFont)comboBoxFont.SelectedItem,
(LatexFontSeries)comboBoxSeries.SelectedItem,
(LatexFontShape)comboBoxShape.SelectedItem);
(LatexFontShape)comboBoxShape.SelectedItem,
(LatexMathFont)comboBoxMathFont.SelectedItem);

// Run once with preview to get depth value
m_finishedSuccessfully = true;
Expand Down Expand Up @@ -348,7 +358,16 @@ private void openLatexTemplateToolStripMenuItem_Click(object sender, EventArgs e
string templateFileName = AddinUtilities.getAppDataLocation() + "\\LatexTemplate.txt";
System.Diagnostics.Process.Start(templateFileName);
}


private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
{

}

private void label3_Click(object sender, EventArgs e)
{

}
}

public class LatexFont
Expand Down Expand Up @@ -399,4 +418,20 @@ public override string ToString()
}
}

public class LatexMathFont
{
public LatexMathFont(string fn, string lpn)
{
fontName = fn;
latexPackageName = lpn;
}
public string fontName;
public string latexPackageName;

public override string ToString()
{
return fontName;
}
}

}
Loading