Skip to content

Commit

Permalink
Fix font and SingleProject to locate manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonghyunCho authored and rookiejava committed Mar 24, 2022
1 parent ff922cb commit 3249c6a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
5 changes: 2 additions & 3 deletions .nuspec/Microsoft.Maui.Resizetizer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -464,17 +464,15 @@

<!-- WPF -->
<ItemGroup Condition="'$(_ResizetizerIsWPFApp)' == 'True'">

<Resource Include="@(_MauiFontCopied)" Condition="'@(_MauiFontCopied)' != ''">
<LogicalName>$([System.IO.Path]::GetFileName(%(_MauiFontCopied.Identity)))</LogicalName>
<Link>$([System.IO.Path]::GetFileName(%(_MauiFontCopied.Identity)))</Link>
</Resource>

</ItemGroup>

<!-- Tizen -->
<ItemGroup Condition="'$(_ResizetizerIsTizenApp)' == 'True'">
<TizenTpkUserIncludeFiles Include="$(IntermediateOutputPath)sp\fonts\*" TizenTpkSubDir="res\fonts\" />
<TizenTpkUserIncludeFiles Include="@(_MauiFontCopied)" Condition="'@(_MauiFontCopied)' != ''" TizenTpkSubDir="res\fonts\" />
</ItemGroup>

<!-- iOS Only -->
Expand Down Expand Up @@ -522,6 +520,7 @@
<!-- Tizen - Move splash images to a specific location -->
<TizenSplashUpdator
Condition="'$(_ResizetizerIsTizenApp)' == 'True'"
ManifestFile="$(TizenManifestFile)"
IntermediateOutputPath="$(ResizetizerIntermediateOutputPath)"
MauiSplashScreen="@(MauiSplashScreen)" />

Expand Down
16 changes: 8 additions & 8 deletions src/Core/src/Fonts/EmbeddedFontLoader.Tizen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using ElmSharp;
using Tizen.Common;
using IOPath = System.IO.Path;
using TApplication = Tizen.Applications.Application;

Expand All @@ -22,8 +23,9 @@ public partial class EmbeddedFontLoader : IEmbeddedFontLoader
}

var filePath = IOPath.Combine(FontCacheDirectory.FullName, font.FontName!);
var name = IOPath.GetFileNameWithoutExtension(filePath);
if (File.Exists(filePath))
return filePath;
return name;
try
{
using (var fileStream = File.Create(filePath))
Expand All @@ -34,13 +36,11 @@ public partial class EmbeddedFontLoader : IEmbeddedFontLoader
font.ResourceStream.CopyTo(fileStream);
}

//TODO: should include below
//if (DotnetUtil.TizenAPIVersion > 5)
//{
// FontExtensions.FontReinit();
//}

return filePath;
if (DotnetUtil.TizenAPIVersion > 5)
{
Utility.FontReinit();
}
return name;
}
catch (Exception ex)
{
Expand Down
1 change: 1 addition & 0 deletions src/Core/src/Fonts/FontManager.Tizen.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Collections.Concurrent;
using Microsoft.Extensions.Logging;

Expand Down
3 changes: 1 addition & 2 deletions src/Core/src/Fonts/FontRegistrar.Tizen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ public partial class FontRegistrar : IFontRegistrar
Stream GetNativeFontStream(string filename, string? alias)
{
// TODO: check other folders as well

var resDirPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
var fontPath = Path.Combine(resDirPath, filename);
var fontPath = Path.Combine(resDirPath, "fonts", filename);
if (File.Exists(fontPath))
return File.OpenRead(fontPath);

Expand Down
5 changes: 4 additions & 1 deletion src/SingleProject/Resizetizer/src/TizenSplashUpdator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public class TizenSplashUpdator : Task
[Required]
public ITaskItem[] MauiSplashScreen { get; set; }

[Required]
public string ManifestFile { get; set; }

[Required]
public string IntermediateOutputPath { get; set; }

Expand Down Expand Up @@ -108,7 +111,7 @@ public void UpdateColorAndMoveFile(string sourceFilePath, string destFilePath)
public void UpdateManifest()
{
XmlDocument doc = new XmlDocument();
var xmlPath = Environment.CurrentDirectory + "\\tizen-manifest.xml";
var xmlPath = Path.Combine(Environment.CurrentDirectory, ManifestFile);
try
{
doc.Load(xmlPath);
Expand Down

0 comments on commit 3249c6a

Please sign in to comment.