Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net Standard version of Typography #105

Closed
Happypig375 opened this issue May 13, 2018 · 26 comments
Closed

.Net Standard version of Typography #105

Happypig375 opened this issue May 13, 2018 · 26 comments

Comments

@Happypig375
Copy link
Contributor

Currently two files of this same type exists in two different places (PixelFarm.Typography and DrawingGL.Common). GlyphPathBuilder.cs, GlyphPathBuilderBase.cs and HintTechnique.cs should reside in the Typography.Contours project (as they should be proper APIs) and not hidden in the Demo projects.

I tried to move them but all of the projects rely on Typography.Contours targeting .NET Framework 2.0 and the mobile demo projects yelled at me. I tried to create Typography.Contours build projects like Typography.OpenFont and Typography.GlyphLayout but the reference errors are too much for me. Finally, turning Typography.Contours into a .NET Standard project to make every project happy results in

Error CS0012 The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Welp, a day of work spent on nothing. I just wanted to make use of these files and follow the code in demos...

The same applies to a lot of types in demo projects that should be proper APIs.

@prepare
Copy link
Member

prepare commented May 13, 2018

Is it Ok if I turn Typography.Contours to .NET standard project?

@Happypig375
Copy link
Contributor Author

I don't know. If this project targets .NET Standard, other projects, including the demo ones, cannot target .NET Framework 2.0 anymore.

@zwcloud
Copy link
Contributor

zwcloud commented May 13, 2018

I would recommend using a shared project to share source code files between .NET Standard Class Library and .NET Framework 2.0 Class Library.

And in the source code, using #if NET_2_0 #elif ... to conditionally include code sections that is used for .NET 2.0. You can define NET_2_0 in the .NET Framework 2.0 class library project manually.

@Happypig375
Copy link
Contributor Author

Happypig375 commented May 13, 2018

@zwcloud
Actually, that is already the case with the shared projects Typography.OpenFont and Typography.GlyphLayout and the 8 projects in the Build folder. Just that the shared platforms are Xamarin.iOS, Xamarin.Android, .NET Framework 2.0 and .NET Core 1.1.

It is very hard to make another one of those for Typography.Contours though.

@zwcloud
Copy link
Contributor

zwcloud commented May 13, 2018

Hah, that's actually introduced by me. Then just do it. @prepare :)

BTW,
Xamarin.iOS and Xamarin.Android now should be compatible with .NET Standard 2.0. See .NET Standard. So those libraries could be merged into one .NET Standard 2.0 class library.

@prepare
Copy link
Member

prepare commented May 13, 2018

Add .net standard support for Typography.Contours

please check this b7cf599 is fit to your need?

project_layout1

project_layout2

@zwcloud
Copy link
Contributor

zwcloud commented May 13, 2018

So Typography.Contours is a lower level of core Typography API. 😆
It's a good start point for a better API design. @prepare

@prepare
Copy link
Member

prepare commented May 13, 2018

It is a very + dirty quick fix :)

It needs more cleanup.

Always welcome all suggestions + API design.
(+ PR(s))

@prepare
Copy link
Member

prepare commented May 13, 2018

So Typography.Contours is a lower level of core Typography API

the 'inner core' to 'outer' one => by order

  1. Typography.OpenFont
  2. Typography.GlyphLayout

other than those (eg. Contours) are not need.

@Happypig375
Copy link
Contributor Author

@prepare
Seems you forgot to commit the Android and iOS build projects for Typography.Contours though.
image

@prepare
Copy link
Member

prepare commented May 13, 2018

please see : 78b3bd7
I added .net standard version of OpenFont, GlyphLayout ,Contours.
You can reference these in new iOS and Android App.

netstandard_layout

(Also removed old Android and iOS project)


Also update Android and iOS examples

example_layout
add 'DroidSans.ttf' for iOS :)


ios

DroidSans.ttf, iOS Emu, Xamarin + GLES2 surface


android_1

DroidSans.ttf, Android Emu, Xamarin + GLES2 surface

@prepare
Copy link
Member

prepare commented May 13, 2018

Android and iOS examples are 'just work' but not optimized yet
(see #45)

I'm fixing it on the main PixelFarm project.
(esp. PaintLab/PixelFarm#20)

@prepare prepare changed the title Please move and combine GlyphPathBuilder files .Net Standard version for Typography.OpenFont, GlyphLayout, Contours May 13, 2018
@prepare prepare changed the title .Net Standard version for Typography.OpenFont, GlyphLayout, Contours .Net Standard version of Typography.OpenFont, GlyphLayout, Contours May 13, 2018
@prepare prepare closed this as completed May 13, 2018
@Happypig375
Copy link
Contributor Author

One thing that I don't understand is why the .NET Framework 2.0-targeting build projects add files as link instead of referencing the shared project. Why add files in two places when you can do it with just one only?

@prepare
Copy link
Member

prepare commented May 14, 2018

for VS2010 (old, with commercial license).
It can't open shared source project.

@zwcloud
Copy link
Contributor

zwcloud commented May 14, 2018

Personally, I think it's better to drop support for VS2010.

@prepare
Copy link
Member

prepare commented May 14, 2018

Yes, after I buy a new Visual Studio Professional :)

@Happypig375
Copy link
Contributor Author

Oh, ok. Thanks for replying.

@Happypig375
Copy link
Contributor Author

@prepare

Yes, after I buy a new Visual Studio Professional :)

Why is Visual Studio 2017 Community not enough for you? ❔

@prepare
Copy link
Member

prepare commented May 14, 2018

Community Edition is fine for this project.

But on another side, I can't use it to develop a software for an enterprise.

(see: https://www.visualstudio.com/vs/compare/
topic: Supported Usage Scenarios > Enterprise )

@Happypig375
Copy link
Contributor Author

Happypig375 commented May 14, 2018

Footnotes:

  1. Enterprise organizations are defined as >250 PCs or > $1 Million US Dollars in annual revenue.

I don't think you ever need to support an organisation this big. If the organisation does reach this big, it can probably afford Visual Studio Enterprise already.

@charlesroddie
Copy link

I don't think this issue should be closed as there are references to
v2.0
even in newer branches.

I would just simplify this to have everything target .net standard, and the "standard" version of .net standard to target is 2.0. (Unrelated to the 2.0 above!)

It's not essential because .net standard 2.0 projects can reference .net framework 4.6.1 code, 99% reliably. But it would be cleaner.

@Happypig375
Copy link
Contributor Author

Hi @prepare, can you please also create .NET Standard versions of Typography.TextServices, TextBreak and TextFlow? I am planning to use them in CSharpMath.

@prepare prepare reopened this Jun 22, 2018
@prepare prepare changed the title .Net Standard version of Typography.OpenFont, GlyphLayout, Contours .Net Standard version of Typography Jun 22, 2018
@prepare
Copy link
Member

prepare commented Jun 22, 2018

@Happypig375 ,

TextServices, TextFlow and TextBreak in the PixelFarm are more developed than in this repo.

Give me a time to merge them back to this repo.

@prepare
Copy link
Member

prepare commented Jun 25, 2018

.Net Standard version of Typography

Is now on dev branch.

see: dbea27b

But Porting back of TextServices, TextFlow, TextBreak are not finish,
so the 3 projects are still the old code (not the latest from PixelFarm) => but in new .net std layout format.

(Porting should be finish soon)


dnstd2
dnstd1

@prepare
Copy link
Member

prepare commented Jun 25, 2018

.Net standard version is still 1.6
but you can upgrade it the 2.0 easily.

@prepare
Copy link
Member

prepare commented Jun 26, 2018

Now, move down to .net-std 1.3

@prepare prepare closed this as completed Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants