Initial Commit

This commit is contained in:
2017-05-23 19:14:40 -04:00
parent fd47650baf
commit c588975b86
79 changed files with 1049 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@@ -0,0 +1,9 @@
<Application x:Class="LatexEditor.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:LatexEditor"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace LatexEditor
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LatexEditor.Fonts
{
public enum CmFont
{
Serif = 0,
SerifOblique,
SerifItalic,
SerifItalicUpright,
SerifBold,
SerifBoldOblique,
SerifBoldItalic,
ClassicalItalic,
Sans,
SansOblique,
SansBold,
SansBoldOblique,
SansDemicondensed,
Typewriter,
TypewriterOblique,
TypewriterItalic,
TypewriterBold,
TypewriterBoldItalic,
TypewriterLight,
TypewriterLightOblique,
TypewriterVariable,
TypewriterVariableItalic,
Concrete,
ConcreteItalic,
ConcreteBold,
ConcreteBoldItalic,
Bright,
BrightSemibold,
BrightSemiboldOblique,
BrightBold,
BrightBoldOblique,
MathItalic,
MathBoldItalic,
MathExtension,
Symbols,
SymbolsBold
}
}

View File

@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace LatexEditor.Fonts
{
public static class CmManager
{
private static readonly Dictionary<CmFont, string> FontCodes = new Dictionary<CmFont, string>
{
[CmFont.Serif] = "cmun/cmunrm",
[CmFont.SerifOblique] = "cmun/cmunsl",
[CmFont.SerifItalic] = "cmun/cmunti",
[CmFont.SerifItalicUpright] = "cmun/cmunui",
[CmFont.SerifBold] = "cmun/cmunbx",
[CmFont.SerifBoldOblique] = "cmun/cmunbl",
[CmFont.SerifBoldItalic] = "cmun/cmunbi",
[CmFont.ClassicalItalic] = "cmun/cmunci",
[CmFont.Sans] = "cmun/cmunss",
[CmFont.SansOblique] = "cmun/cmunsi",
[CmFont.SansBold] = "cmun/cmunsx",
[CmFont.SansBoldOblique] = "cmun/cmunso",
[CmFont.SansDemicondensed] = "cmun/cmunssdc",
[CmFont.Typewriter] = "cmun/cmuntt",
[CmFont.TypewriterOblique] = "cmun/cmunst",
[CmFont.TypewriterItalic] = "cmun/cmunit",
[CmFont.TypewriterBold] = "cmun/cmuntb",
[CmFont.TypewriterBoldItalic] = "cmun/cmuntx",
[CmFont.TypewriterLight] = "cmun/cmunbtl",
[CmFont.TypewriterLightOblique] = "cmun/cmunbto",
[CmFont.TypewriterVariable] = "cmun/cmunvt",
[CmFont.TypewriterVariableItalic] = "cmun/cmunvi",
[CmFont.Concrete] = "cmun/cmunorm",
[CmFont.ConcreteItalic] = "cmun/cmunoti",
[CmFont.ConcreteBold] = "cmun/cmunobx",
[CmFont.ConcreteBoldItalic] = "cmun/cmunobi",
[CmFont.Bright] = "cmun/cmunbmr",
[CmFont.BrightSemibold] = "cmun/cmunbmo",
[CmFont.BrightSemiboldOblique] = "cmun/cmunbsr",
[CmFont.BrightBold] = "cmun/cmunbbx",
[CmFont.BrightBoldOblique] = "cmun/cmunbxo",
[CmFont.MathItalic] = "cm/cmmi",
[CmFont.MathBoldItalic] = "cm/cmmib",
[CmFont.MathExtension] = "cm/cmex",
[CmFont.Symbols] = "cm/cmsy",
[CmFont.SymbolsBold] = "cm/cmbsy",
};
private static readonly Dictionary<CmFont, int[]> EmSizes = new Dictionary<CmFont, int[]>
{
[CmFont.MathItalic] = new[] { 5, 6, 7, 8, 9, 10, 12 },
[CmFont.MathBoldItalic] = new[] { 6, 7, 8, 9, 10 },
[CmFont.MathExtension] = new[] { 7, 8, 9, 10 },
[CmFont.Symbols] = new[] { 5, 6, 7, 8, 9, 10 },
[CmFont.SymbolsBold] = new[] { 6, 7, 8, 9, 10 }
};
private static readonly Dictionary<string, GlyphTypeface> Fonts = new Dictionary<string, GlyphTypeface>();
public static GlyphTypeface GlyphTypeface(this CmFont font, double emSize = 10)
{
var code = FontCodes[font];
if (EmSizes.ContainsKey(font))
{
// take font size which is closest to the em size
var size = EmSizes[font]
.OrderBy(s => Math.Abs(s - emSize))
.First();
code = code + size;
}
if (Fonts.ContainsKey(code)) return Fonts[code];
var uri = new Uri("pack://application:,,,/LatexEditor;component/Fonts/" + code + ".ttf");
return Fonts[code] = new GlyphTypeface(uri);
}
}
}

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
namespace LatexEditor.Fonts
{
public class GlyphInfo
{
public CmFont Font;
public Point Offset;
public double Size;
private int Char;
public GlyphTypeface Gtf => Font.GlyphTypeface();
/// <summary>
/// Index of this glyph within the GlyphTypeface.
/// </summary>
/// <exception cref="KeyNotFoundException">Thrown if <see cref="Font"/> does not have a glyph for char <see cref="Char"/></exception>
public ushort Index => Gtf.CharacterToGlyphMap[Char];
public GlyphInfo(CmFont font, int character, double size, Point offset)
{
Font = font;
Char = character;
Size = size;
Offset = offset;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,33 @@
/CMUBright-Bold (cmunbbx.ttf) ;
/CMUSerif-BoldItalic (cmunbi.ttf) ;
/CMUSerif-BoldSlanted (cmunbl.ttf) ;
/CMUBright-Oblique (cmunbmo.ttf) ;
/CMUBright-Roman (cmunbmr.ttf) ;
/CMUBright-SemiboldOblique (cmunbso.ttf) ;
/CMUBright-Semibold (cmunbsr.ttf) ;
/CMUTypewriter-Light (cmunbtl.ttf) ;
/CMUTypewriter-LightOblique (cmunbto.ttf) ;
/CMUSerif-Bold (cmunbx.ttf) ;
/CMUBright-BoldOblique (cmunbxo.ttf) ;
/CMUClassicalSerif-Italic (cmunci.ttf) ;
/CMUTypewriter-Italic (cmunit.ttf) ;
/CMUConcrete-BoldItalic (cmunobi.ttf) ;
/CMUConcrete-Bold (cmunobx.ttf) ;
/CMUConcrete-Roman (cmunorm.ttf) ;
/CMUConcrete-Italic (cmunoti.ttf) ;
/CMUSerif-BoldNonextended (cmunrb.ttf) ;
/CMUSerif-Roman (cmunrm.ttf) ;
/CMUSansSerif-Oblique (cmunsi.ttf) ;
/CMUSerif-RomanSlanted (cmunsl.ttf) ;
/CMUSansSerif-BoldOblique (cmunso.ttf) ;
/CMUSansSerif (cmunss.ttf) ;
/CMUSansSerif-DemiCondensed (cmunssdc.ttf) ;
/CMUTypewriter-Oblique (cmunst.ttf) ;
/CMUSansSerif-Bold (cmunsx.ttf) ;
/CMUTypewriter-Bold (cmuntb.ttf) ;
/CMUSerif-Italic (cmunti.ttf) ;
/CMUTypewriter-Regular (cmuntt.ttf) ;
/CMUTypewriter-BoldItalic (cmuntx.ttf) ;
/CMUSerif-UprightItalic (cmunui.ttf) ;
/CMUTypewriterVariable-Italic (cmunvi.ttf) ;
/CMUTypewriterVariable (cmunvt.ttf) ;

View File

@@ -0,0 +1,103 @@
Copyright (C) Authors of original metafont fonts:
Donald Ervin Knuth (cm, concrete fonts)
1995, 1996, 1997 J"org Knappen, 1990, 1992 Norbert Schwarz (ec fonts)
1992-2006 A.Khodulev, O.Lapko, A.Berdnikov, V.Volovich (lh fonts)
1997-2005 Claudio Beccari (cb greek fonts)
2002 FUKUI Rei (tipa fonts)
2003-2005 Han The Thanh (Vietnamese fonts)
1996-2005 Walter Schmidt (cmbright fonts)
Copyright (C) 2003-2009, Andrey V. Panov (panov@canopus.iacp.dvo.ru),
with Reserved Font Family Name "Computer Modern Unicode fonts".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Media;
using LatexEditor.Fonts;
namespace LatexEditor
{
[ContentProperty("Content")]
public class LatexDocument : FrameworkElement
{
public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register("Content", typeof(string), typeof(LatexDocument),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
[Category("LaTeX")]
[Description("LaTeX markup")]
public string Content
{
get => (string)GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
public static readonly DependencyProperty FontSizeProperty =
DependencyProperty.Register("FontSize", typeof(double), typeof(LatexDocument),
new FrameworkPropertyMetadata(20d, FrameworkPropertyMetadataOptions.AffectsRender));
[Category("LaTeX")]
[Description("LaTeX font scaling")]
public double FontSize
{
get => (double)GetValue(FontSizeProperty);
set => SetValue(FontSizeProperty, value);
}
protected List<GlyphInfo> Parse(string latex)
{
var x = 0d;
var y = 0d;
var font = CmFont.SerifItalic;
var size = FontSize;
var glyphs = new List<GlyphInfo>(latex.Length);
var state = new Stack<string>();
state.Push("-");
while (latex.Length > 0)
{
var s = state.Peek();
if (s == "cmd")
{
state.Pop();
var m = Regex.Match(latex, @"([a-z]+)(?=[^a-z]|$)", RegexOptions.IgnoreCase);
if (m.Index == 0)
{
var cmd = latex.Substring(0, m.Groups[1].Length);
switch (cmd)
{
case "it":
font = CmFont.SerifItalic;
break;
case "sym":
font = CmFont.Symbols;
break;
case "rm":
font = CmFont.Serif;
break;
case "sup":
size = FontSize * 0.4;
y = FontSize * (1 - 0.4);
break;
case "sub":
size = FontSize * 0.5;
y = -FontSize * 0.5 * 0.5;
break;
default:
continue;
}
latex = latex.Substring(m.Length).TrimStart(' ');
}
else
{
latex = latex.Substring(1);
}
}
else
{
if (latex.StartsWith("\\"))
{
latex = latex.Substring(1);
state.Push("cmd");
}
else
{
var chr = latex[0];
latex = latex.Substring(1);
var gtf = font.GlyphTypeface();
var point = new Point(x, y);
var gi = new GlyphInfo(font, chr, size, point);
x += gtf.AdvanceWidths[gi.Index] * size;
glyphs.Add(gi);
}
}
}
return glyphs;
}
protected override void OnRender(DrawingContext dc)
{
var text = Content;
if (string.IsNullOrEmpty(text)) return;
var glyphInfoList = Parse(text);
var gtfGroups = glyphInfoList.GroupBy(gi => gi.Gtf);
foreach (var gtfGroup in gtfGroups)
{
var gtf = gtfGroup.Key;
var sizeGroups = gtfGroup.GroupBy(gi => gi.Size);
foreach (var sizeGroup in sizeGroups)
{
var size = sizeGroup.Key;
var glyphs = sizeGroup.Select(gi => gi.Index).ToList();
var advanceWidths = new double[glyphs.Count];
var offsets = sizeGroup.Select(gi => gi.Offset).ToList();
var gr = new GlyphRun(gtf, 0, false, size,
glyphs, new Point(0, FontSize), advanceWidths,
offsets, null, null, null, null, null);
dc.DrawGlyphRun(Brushes.Black, gr);
}
}
}
}
}

View File

@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{76364E84-547C-4589-90B6-2A07A2A91AC7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>LatexEditor</RootNamespace>
<AssemblyName>LatexEditor</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Fonts\CmManager.cs" />
<Compile Include="Fonts\CmFont.cs" />
<Compile Include="Fonts\GlyphInfo.cs" />
<Compile Include="LatexDocument.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Resource Include="Fonts\cm\cmmi10.ttf" />
<Resource Include="Fonts\cm\cmmi12.ttf" />
<Resource Include="Fonts\cm\cmmi5.ttf" />
<Resource Include="Fonts\cm\cmmi6.ttf" />
<Resource Include="Fonts\cm\cmmi7.ttf" />
<Resource Include="Fonts\cm\cmmi8.ttf" />
<Resource Include="Fonts\cm\cmmi9.ttf" />
<Resource Include="Fonts\cm\cmmib10.ttf" />
<Resource Include="Fonts\cm\cmmib6.ttf" />
<Resource Include="Fonts\cm\cmmib7.ttf" />
<Resource Include="Fonts\cm\cmmib8.ttf" />
<Resource Include="Fonts\cm\cmmib9.ttf" />
<Resource Include="Fonts\cm\cmex10.ttf" />
<Resource Include="Fonts\cm\cmex7.ttf" />
<Resource Include="Fonts\cm\cmex8.ttf" />
<Resource Include="Fonts\cm\cmex9.ttf" />
<Resource Include="Fonts\cm\cmsy10.ttf" />
<Resource Include="Fonts\cm\cmsy5.ttf" />
<Resource Include="Fonts\cm\cmsy6.ttf" />
<Resource Include="Fonts\cm\cmsy7.ttf" />
<Resource Include="Fonts\cm\cmsy8.ttf" />
<Resource Include="Fonts\cm\cmsy9.ttf" />
<Resource Include="Fonts\cm\cmbsy10.ttf" />
<Resource Include="Fonts\cm\cmbsy6.ttf" />
<Resource Include="Fonts\cm\cmbsy7.ttf" />
<Resource Include="Fonts\cm\cmbsy8.ttf" />
<Resource Include="Fonts\cm\cmbsy9.ttf" />
<Resource Include="Fonts\cmun\cmunbbx.ttf" />
<Resource Include="Fonts\cmun\cmunbi.ttf" />
<Resource Include="Fonts\cmun\cmunbl.ttf" />
<Resource Include="Fonts\cmun\cmunbmo.ttf" />
<Resource Include="Fonts\cmun\cmunbmr.ttf" />
<Resource Include="Fonts\cmun\cmunbso.ttf" />
<Resource Include="Fonts\cmun\cmunbsr.ttf" />
<Resource Include="Fonts\cmun\cmunbtl.ttf" />
<Resource Include="Fonts\cmun\cmunbto.ttf" />
<Resource Include="Fonts\cmun\cmunbx.ttf" />
<Resource Include="Fonts\cmun\cmunbxo.ttf" />
<Resource Include="Fonts\cmun\cmunci.ttf" />
<Resource Include="Fonts\cmun\cmunit.ttf" />
<Resource Include="Fonts\cmun\cmunobi.ttf" />
<Resource Include="Fonts\cmun\cmunobx.ttf" />
<Resource Include="Fonts\cmun\cmunorm.ttf" />
<Resource Include="Fonts\cmun\cmunoti.ttf" />
<Resource Include="Fonts\cmun\cmunrb.ttf" />
<Resource Include="Fonts\cmun\cmunrm.ttf" />
<Resource Include="Fonts\cmun\cmunsi.ttf" />
<Resource Include="Fonts\cmun\cmunsl.ttf" />
<Resource Include="Fonts\cmun\cmunso.ttf" />
<Resource Include="Fonts\cmun\cmunss.ttf" />
<Resource Include="Fonts\cmun\cmunssdc.ttf" />
<Resource Include="Fonts\cmun\cmunst.ttf" />
<Resource Include="Fonts\cmun\cmunsx.ttf" />
<Resource Include="Fonts\cmun\cmuntb.ttf" />
<Resource Include="Fonts\cmun\cmunti.ttf" />
<Resource Include="Fonts\cmun\cmuntt.ttf" />
<Resource Include="Fonts\cmun\cmuntx.ttf" />
<Resource Include="Fonts\cmun\cmunui.ttf" />
<Resource Include="Fonts\cmun\cmunvi.ttf" />
<Resource Include="Fonts\cmun\cmunvt.ttf" />
<None Include="Fonts\cmun\Fontmap.CMU" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Fonts\cmun\OFL.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,14 @@
<Window x:Class="LatexEditor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LatexEditor"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<local:LatexDocument>
\sym h \it x, y \sym i
</local:LatexDocument>
</Grid>
</Window>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace LatexEditor
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LatexEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LatexEditor")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LatexEditor.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LatexEditor.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LatexEditor.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

22
WpfTex/WpfTex.sln Normal file
View File

@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LatexEditor", "LatexEditor\LatexEditor.csproj", "{76364E84-547C-4589-90B6-2A07A2A91AC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{76364E84-547C-4589-90B6-2A07A2A91AC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76364E84-547C-4589-90B6-2A07A2A91AC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76364E84-547C-4589-90B6-2A07A2A91AC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76364E84-547C-4589-90B6-2A07A2A91AC7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal