├── .gitattributes ├── .github └── workflows │ └── afs-cmd-ci.yml ├── .gitignore ├── AssFontSubset.Avalonia ├── App.axaml ├── App.axaml.cs ├── AssFontSubset.Avalonia.csproj ├── Assets │ └── avalonia-logo.ico ├── I18n │ ├── Resources.Designer.cs │ ├── Resources.resx │ └── Resources.zh-hans.resx ├── Program.cs ├── ViewModels │ ├── MainWindowViewModel.cs │ └── ViewModelBase.cs ├── Views │ ├── MainWindow.axaml │ └── MainWindow.axaml.cs └── app.manifest ├── AssFontSubset.Console ├── AssFontSubset.Console.csproj └── Program.cs ├── AssFontSubset.Core ├── AssFontSubset.Core.csproj └── src │ ├── AssFont.cs │ ├── FontConstant.cs │ ├── FontParse.cs │ ├── HarfBuzzSubset.cs │ ├── PyFontTools.cs │ ├── SubsetConfig.cs │ ├── SubsetCore.cs │ ├── SubsetFont.cs │ └── SubsetToolBase.cs ├── AssFontSubset.CoreTests ├── AssFontSubset.Core.Tests.csproj └── src │ └── AssFontTests.cs ├── AssFontSubset.sln ├── AssFontSubset.slnx ├── HarfBuzzBinding ├── HarfBuzzBinding.csproj ├── README.md └── src │ ├── Methods.cs │ └── Native │ ├── Apis.cs │ ├── Library.cs │ ├── NativeTypeNameAttribute.cs │ └── Subset │ ├── Apis.cs │ ├── hb_subset_flags_t.cs │ └── hb_subset_sets_t.cs ├── README.md ├── README_v1.md ├── build └── global.props └── nuget.config /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/workflows/afs-cmd-ci.yml: -------------------------------------------------------------------------------- 1 | name: Build afs.cmd 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | paths: 7 | - 'AssFontSubset.Core/**.cs' 8 | - 'AssFontSubset.Core/**.csproj' 9 | - 'AssFontSubset.Console/**.cs' 10 | - 'AssFontSubset.Console/**.csproj' 11 | pull_request: 12 | branches: [ "master" ] 13 | paths: 14 | - 'AssFontSubset.Core/**.cs' 15 | - 'AssFontSubset.Core/**.csproj' 16 | - 'AssFontSubset.Console/**.cs' 17 | - 'AssFontSubset.Console/**.csproj' 18 | workflow_dispatch: 19 | 20 | jobs: 21 | build: 22 | name: build-${{ matrix.config.target }}-${{ matrix.arch }} 23 | runs-on: ${{ matrix.config.os }} 24 | env: 25 | identifier: ${{ matrix.config.target }}-${{ matrix.arch }} 26 | strategy: 27 | matrix: 28 | harfbuzz_ver: ['10.1.0'] 29 | dotnet_version: ['9.x'] 30 | config: 31 | - os: windows-latest 32 | target: win 33 | framework: net9.0 34 | - os: windows-latest 35 | target: linux-musl 36 | framework: net8.0 # need zig fix? https://github.com/ziglang/zig/pull/20081 37 | - os: macos-latest 38 | target: osx 39 | framework: net9.0 40 | arch: [x64, arm64] 41 | 42 | steps: 43 | 44 | - name: Setup .NET 45 | uses: actions/setup-dotnet@v4 46 | with: 47 | dotnet-version: ${{ matrix.dotnet_version }} 48 | 49 | - name: Checkout 50 | uses: actions/checkout@v4 51 | 52 | - name: Test 53 | if: matrix.config.target != 'osx' 54 | run: | 55 | dotnet --version 56 | cd ./AssFontSubset.CoreTests 57 | dotnet restore 58 | dotnet test 59 | cd .. 60 | 61 | - name: Setup Zig Compiler (target linux) 62 | if: matrix.config.target == 'linux-musl' 63 | uses: mlugg/setup-zig@v1 64 | with: 65 | version: "master" 66 | 67 | - name: Add llvm-objcopy (target linux) 68 | if: matrix.config.target == 'linux-musl' 69 | run: | 70 | Invoke-WebRequest -Uri https://github.com/MIRIMIRIM/build-harfbuzz/releases/download/utils/llvm-objcopy.exe -OutFile ./AssFontSubset.Console/llvm-objcopy.exe 71 | 72 | - name: Change to afs.cmd and Publish 73 | run: | 74 | cd ./AssFontSubset.Console 75 | dotnet restore 76 | dotnet publish -c Release -r ${{ env.identifier }} -f ${{ matrix.config.framework }} 77 | 78 | - name: Set short version 79 | shell: bash 80 | run: | 81 | ver_short=`git rev-parse --short HEAD` 82 | echo "VERSION=$ver_short" >> $GITHUB_ENV 83 | 84 | - name: Upload exe files 85 | uses: actions/upload-artifact@v4 86 | with: 87 | name: AssFontSubset.Console_g${{ env.VERSION }}_${{ env.identifier }} 88 | path: | 89 | AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/ 90 | !AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.a 91 | !AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.pdb 92 | !AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.dbg 93 | !AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.dwarf 94 | !AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.dSYM 95 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | build/*.7z 25 | build/*.bat 26 | build/*.zip 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | # Uncomment if you have tasks that create the project's static files in wwwroot 31 | #wwwroot/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | # NUNIT 38 | *.VisualState.xml 39 | TestResult.xml 40 | 41 | # Build Results of an ATL Project 42 | [Dd]ebugPS/ 43 | [Rr]eleasePS/ 44 | dlldata.c 45 | 46 | # DNX 47 | project.lock.json 48 | project.fragment.lock.json 49 | artifacts/ 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # NCrunch 117 | _NCrunch_* 118 | .*crunch*.local.xml 119 | nCrunchTemp_* 120 | 121 | # MightyMoose 122 | *.mm.* 123 | AutoTest.Net/ 124 | 125 | # Web workbench (sass) 126 | .sass-cache/ 127 | 128 | # Installshield output folder 129 | [Ee]xpress/ 130 | 131 | # DocProject is a documentation generator add-in 132 | DocProject/buildhelp/ 133 | DocProject/Help/*.HxT 134 | DocProject/Help/*.HxC 135 | DocProject/Help/*.hhc 136 | DocProject/Help/*.hhk 137 | DocProject/Help/*.hhp 138 | DocProject/Help/Html2 139 | DocProject/Help/html 140 | 141 | # Click-Once directory 142 | publish/ 143 | 144 | # Publish Web Output 145 | *.[Pp]ublish.xml 146 | *.azurePubxml 147 | # TODO: Comment the next line if you want to checkin your web deploy settings 148 | # but database connection strings (with potential passwords) will be unencrypted 149 | #*.pubxml 150 | *.publishproj 151 | 152 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 153 | # checkin your Azure Web App publish settings, but sensitive information contained 154 | # in these scripts will be unencrypted 155 | PublishScripts/ 156 | 157 | # NuGet Packages 158 | *.nupkg 159 | # The packages folder can be ignored because of Package Restore 160 | **/packages/* 161 | # except build/, which is used as an MSBuild target. 162 | !**/packages/build/ 163 | # Uncomment if necessary however generally it will be regenerated when needed 164 | #!**/packages/repositories.config 165 | # NuGet v3's project.json files produces more ignoreable files 166 | *.nuget.props 167 | *.nuget.targets 168 | 169 | # Microsoft Azure Build Output 170 | csx/ 171 | *.build.csdef 172 | 173 | # Microsoft Azure Emulator 174 | ecf/ 175 | rcf/ 176 | 177 | # Windows Store app package directories and files 178 | AppPackages/ 179 | BundleArtifacts/ 180 | Package.StoreAssociation.xml 181 | _pkginfo.txt 182 | 183 | # Visual Studio cache files 184 | # files ending in .cache can be ignored 185 | *.[Cc]ache 186 | # but keep track of directories ending in .cache 187 | !*.[Cc]ache/ 188 | 189 | # Others 190 | ClientBin/ 191 | ~$* 192 | *~ 193 | *.dbmdl 194 | *.dbproj.schemaview 195 | *.jfm 196 | *.pfx 197 | *.publishsettings 198 | node_modules/ 199 | orleans.codegen.cs 200 | 201 | # Since there are multiple workflows, uncomment next line to ignore bower_components 202 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 203 | #bower_components/ 204 | 205 | # RIA/Silverlight projects 206 | Generated_Code/ 207 | 208 | # Backup & report files from converting an old project file 209 | # to a newer Visual Studio version. Backup files are not needed, 210 | # because we have git ;-) 211 | _UpgradeReport_Files/ 212 | Backup*/ 213 | UpgradeLog*.XML 214 | UpgradeLog*.htm 215 | 216 | # SQL Server files 217 | *.mdf 218 | *.ldf 219 | 220 | # Business Intelligence projects 221 | *.rdl.data 222 | *.bim.layout 223 | *.bim_*.settings 224 | 225 | # Microsoft Fakes 226 | FakesAssemblies/ 227 | 228 | # GhostDoc plugin setting file 229 | *.GhostDoc.xml 230 | 231 | # Node.js Tools for Visual Studio 232 | .ntvs_analysis.dat 233 | 234 | # Visual Studio 6 build log 235 | *.plg 236 | 237 | # Visual Studio 6 workspace options file 238 | *.opt 239 | 240 | # Visual Studio LightSwitch build output 241 | **/*.HTMLClient/GeneratedArtifacts 242 | **/*.DesktopClient/GeneratedArtifacts 243 | **/*.DesktopClient/ModelManifest.xml 244 | **/*.Server/GeneratedArtifacts 245 | **/*.Server/ModelManifest.xml 246 | _Pvt_Extensions 247 | 248 | # Paket dependency manager 249 | .paket/paket.exe 250 | paket-files/ 251 | 252 | # FAKE - F# Make 253 | .fake/ 254 | 255 | # JetBrains Rider 256 | .idea/ 257 | *.sln.iml 258 | 259 | # CodeRush 260 | .cr/ 261 | 262 | # Python Tools for Visual Studio (PTVS) 263 | __pycache__/ 264 | *.pyc 265 | 266 | # Test Files 267 | test/ 268 | */Properties/* 269 | /native 270 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using AssFontSubset.Avalonia.ViewModels; 2 | using AssFontSubset.Avalonia.Views; 3 | using Avalonia; 4 | using Avalonia.Controls.ApplicationLifetimes; 5 | using Avalonia.Data.Core; 6 | using Avalonia.Data.Core.Plugins; 7 | using Avalonia.Markup.Xaml; 8 | 9 | namespace AssFontSubset.Avalonia 10 | { 11 | public partial class App : Application 12 | { 13 | public override void Initialize() 14 | { 15 | AvaloniaXamlLoader.Load(this); 16 | } 17 | 18 | public override void OnFrameworkInitializationCompleted() 19 | { 20 | I18n.Resources.Culture = System.Globalization.CultureInfo.CurrentUICulture; 21 | 22 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 23 | { 24 | // Line below is needed to remove Avalonia data validation. 25 | // Without this line you will get duplicate validations from both Avalonia and CT 26 | BindingPlugins.DataValidators.RemoveAt(0); 27 | desktop.MainWindow = new MainWindow 28 | { 29 | DataContext = new MainWindowViewModel(), 30 | }; 31 | } 32 | 33 | base.OnFrameworkInitializationCompleted(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/AssFontSubset.Avalonia.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | true 5 | app.manifest 6 | true 7 | False 8 | 9 | 10 | False 11 | 12 | 13 | False 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | PublicResXFileCodeGenerator 39 | Resources.Designer.cs 40 | 41 | 42 | 43 | 44 | 45 | True 46 | True 47 | Resources.resx 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/Assets/avalonia-logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmusementClub/AssFontSubset/1f64e7d4285e4211c9593c66e00b278b7d9e53aa/AssFontSubset.Avalonia/Assets/avalonia-logo.ico -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/I18n/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace AssFontSubset.Avalonia.I18n { 11 | using System; 12 | 13 | 14 | /// 15 | /// A strongly-typed resource class, for looking up localized strings, etc. 16 | /// 17 | // This class was auto-generated by the StronglyTypedResourceBuilder 18 | // class via a tool like ResGen or Visual Studio. 19 | // To add or remove a member, edit your .ResX file then rerun ResGen 20 | // with the /str option, or rebuild your VS project. 21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 24 | public class Resources { 25 | 26 | private static global::System.Resources.ResourceManager resourceMan; 27 | 28 | private static global::System.Globalization.CultureInfo resourceCulture; 29 | 30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 31 | internal Resources() { 32 | } 33 | 34 | /// 35 | /// Returns the cached ResourceManager instance used by this class. 36 | /// 37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 38 | public static global::System.Resources.ResourceManager ResourceManager { 39 | get { 40 | if (object.ReferenceEquals(resourceMan, null)) { 41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AssFontSubset.Avalonia.I18n.Resources", typeof(Resources).Assembly); 42 | resourceMan = temp; 43 | } 44 | return resourceMan; 45 | } 46 | } 47 | 48 | /// 49 | /// Overrides the current thread's CurrentUICulture property for all 50 | /// resource lookups using this strongly typed resource class. 51 | /// 52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 53 | public static global::System.Globalization.CultureInfo Culture { 54 | get { 55 | return resourceCulture; 56 | } 57 | set { 58 | resourceCulture = value; 59 | } 60 | } 61 | 62 | /// 63 | /// Looks up a localized string similar to HarfBuzz-Subset. 64 | /// 65 | public static string BackendHarfbuzzSubset { 66 | get { 67 | return ResourceManager.GetString("BackendHarfbuzzSubset", resourceCulture); 68 | } 69 | } 70 | 71 | /// 72 | /// Looks up a localized string similar to Use Harfbuzz-Subset subset fonts.. 73 | /// 74 | public static string BackendHarfbuzzSubsetTip { 75 | get { 76 | return ResourceManager.GetString("BackendHarfbuzzSubsetTip", resourceCulture); 77 | } 78 | } 79 | 80 | /// 81 | /// Looks up a localized string similar to Clear. 82 | /// 83 | public static string ClearInput { 84 | get { 85 | return ResourceManager.GetString("ClearInput", resourceCulture); 86 | } 87 | } 88 | 89 | /// 90 | /// Looks up a localized string similar to Debug. 91 | /// 92 | public static string DebugOption { 93 | get { 94 | return ResourceManager.GetString("DebugOption", resourceCulture); 95 | } 96 | } 97 | 98 | /// 99 | /// Looks up a localized string similar to Keep subset temp files when enabled.. 100 | /// 101 | public static string DebugOptionTip { 102 | get { 103 | return ResourceManager.GetString("DebugOptionTip", resourceCulture); 104 | } 105 | } 106 | 107 | /// 108 | /// Looks up a localized string similar to No ass files. Please check!. 109 | /// 110 | public static string ErrorNoAssFile { 111 | get { 112 | return ResourceManager.GetString("ErrorNoAssFile", resourceCulture); 113 | } 114 | } 115 | 116 | /// 117 | /// Looks up a localized string similar to ASS Subtitles. 118 | /// 119 | public static string InputAssFiles { 120 | get { 121 | return ResourceManager.GetString("InputAssFiles", resourceCulture); 122 | } 123 | } 124 | 125 | /// 126 | /// Looks up a localized string similar to Font Folder. 127 | /// 128 | public static string InputFontFolder { 129 | get { 130 | return ResourceManager.GetString("InputFontFolder", resourceCulture); 131 | } 132 | } 133 | 134 | /// 135 | /// Looks up a localized string similar to Output Folder. 136 | /// 137 | public static string OutputFolder { 138 | get { 139 | return ResourceManager.GetString("OutputFolder", resourceCulture); 140 | } 141 | } 142 | 143 | /// 144 | /// Looks up a localized string similar to SourceHan Ellipsis. 145 | /// 146 | public static string SourceHanEllipsis { 147 | get { 148 | return ResourceManager.GetString("SourceHanEllipsis", resourceCulture); 149 | } 150 | } 151 | 152 | /// 153 | /// Looks up a localized string similar to A special hack. The ellipses of Source Han fonts will be aligned in the center when enabled.. 154 | /// 155 | public static string SourceHanEllipsisTip { 156 | get { 157 | return ResourceManager.GetString("SourceHanEllipsisTip", resourceCulture); 158 | } 159 | } 160 | 161 | /// 162 | /// Looks up a localized string similar to Start. 163 | /// 164 | public static string StartButton { 165 | get { 166 | return ResourceManager.GetString("StartButton", resourceCulture); 167 | } 168 | } 169 | 170 | /// 171 | /// Looks up a localized string similar to Subset. 172 | /// 173 | public static string Subset { 174 | get { 175 | return ResourceManager.GetString("Subset", resourceCulture); 176 | } 177 | } 178 | 179 | /// 180 | /// Looks up a localized string similar to Subset Completed. Please check Output Folder.. 181 | /// 182 | public static string SuccessSubset { 183 | get { 184 | return ResourceManager.GetString("SuccessSubset", resourceCulture); 185 | } 186 | } 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/I18n/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | text/microsoft-resx 11 | 12 | 13 | 1.3 14 | 15 | 16 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17 | 18 | 19 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 20 | 21 | 22 | Subset 23 | 24 | 25 | ASS Subtitles 26 | 27 | 28 | Font Folder 29 | 30 | 31 | Output Folder 32 | 33 | 34 | Start 35 | 36 | 37 | Clear 38 | 39 | 40 | SourceHan Ellipsis 41 | 42 | 43 | A special hack. The ellipses of Source Han fonts will be aligned in the center when enabled. 44 | 45 | 46 | Debug 47 | 48 | 49 | Keep subset temp files when enabled. 50 | 51 | 52 | HarfBuzz-Subset 53 | 54 | 55 | No ass files. Please check! 56 | 57 | 58 | Subset Completed. Please check Output Folder. 59 | 60 | 61 | Use Harfbuzz-Subset subset fonts. 62 | 63 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/I18n/Resources.zh-hans.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | text/microsoft-resx 4 | 5 | 6 | 1.3 7 | 8 | 9 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 10 | 11 | 12 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 13 | 14 | 15 | 子集化 16 | 17 | 18 | 字幕文件 19 | 20 | 21 | 字体目录 22 | 23 | 24 | 输出目录 25 | 26 | 27 | 开 始 28 | 29 | 30 | 清空 31 | 32 | 33 | 居中思源省略号 34 | 35 | 36 | A special hack. 打开后,思源黑体和宋体的省略号会被居中对齐。 37 | 38 | 39 | 调试选项 40 | 41 | 42 | 打开后会保留各种临时文件,用于检查字体名字等在各个阶段是否正确。 43 | 44 | 45 | 没有 ASS 文件可供处理,请检查 46 | 47 | 48 | 子集化完成,请检查 output 文件夹 49 | 50 | 51 | 使用 Harfbuzz-Subset 子集化字体。 52 | 53 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Logging; 3 | using System; 4 | 5 | namespace AssFontSubset.Avalonia 6 | { 7 | internal sealed class Program 8 | { 9 | // Initialization code. Don't use any Avalonia, third-party APIs or any 10 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 11 | // yet and stuff might break. 12 | [STAThread] 13 | public static void Main(string[] args) => BuildAvaloniaApp() 14 | .StartWithClassicDesktopLifetime(args); 15 | 16 | // Avalonia configuration, don't remove; also used by visual designer. 17 | public static AppBuilder BuildAvaloniaApp() 18 | => AppBuilder.Configure() 19 | .UsePlatformDetect() 20 | .With(new AvaloniaNativePlatformOptions { RenderingMode = [AvaloniaNativeRenderingMode.Software] }) 21 | .WithInterFont() 22 | .LogToTrace(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/ViewModels/MainWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace AssFontSubset.Avalonia.ViewModels; 4 | 5 | public partial class MainWindowViewModel : ViewModelBase 6 | { 7 | public static string WindowTitle => $"AssFontSubset v{Assembly.GetEntryAssembly()!.GetName().Version}"; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | 3 | namespace AssFontSubset.Avalonia.ViewModels 4 | { 5 | public class ViewModelBase : ObservableObject 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /AssFontSubset.Avalonia/Views/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |