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

PDF rendering library #2

Closed
pathway27 opened this issue Mar 24, 2017 · 11 comments
Closed

PDF rendering library #2

pathway27 opened this issue Mar 24, 2017 · 11 comments

Comments

@pathway27
Copy link
Owner

pathway27 commented Mar 24, 2017

The original mupdf in the bookr source compiles, but is really old.

The latest mupdf however uses AGPLv3, might have to change this repo to GPLv3 to port it and use it?

It also has many other file types it can parse. However, it requires Harfbuzz which does not seem to compile well...

Luckily bookr was/is GPLv2+.

@ebraminio
Copy link
Contributor

What is the issue with harfbuzz? I think I can help on that. BTW I couldn't build this on macOS Sierra,

make[1]: Nothing to be done for `all'.
g++ -g3 -Wall -W -Wno-unused -O0 -pipe -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib src/bookr.o src/bkuser.o src/graphics/fzscreenglfw.o src/graphics/shaders/shader.o src/graphics/fzrefcount.o src/graphics/fzimage.o src/graphics/fztexture.o src/graphics/fzinstreammem.o src/graphics/fzfont.o src/graphics/fzscreencommon.o src/bklayer.o src/bklogo.o -L/usr/X11/lib -Lext/tinyxml2 -framework OpenGL -framework AGL -framework Cocoa -framework Foundation -lglew -lglfw -ldl -lobjc -lstdc++ -L/usr/local/lib -lz -lpng -lfreetype -ltinyxml2 -lSOIL -o bookr.glfw
Undefined symbols for architecture x86_64:
  "BKDocument::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)", referenced from:
      _main in bookr.o
  "BKMainMenu::getPopupMode()", referenced from:
      _main in bookr.o
  "BKMainMenu::getPopupText()", referenced from:
      _main in bookr.o
  "BKMainMenu::create()", referenced from:
      _main in bookr.o
  "BKFileChooser::getFullPath(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)", referenced from:
      _main in bookr.o
  "BKFileChooser::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, int)", referenced from:
      _main in bookr.o
  "BKPopup::create(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
      _main in bookr.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bookr.glfw] Error 1

Any hint?

I had to apply these also:

diff --git a/src/bklayer.cpp b/src/bklayer.cpp
index 2e8c3bf..b6308c0 100644
--- a/src/bklayer.cpp
+++ b/src/bklayer.cpp
@@ -71,7 +71,7 @@ void BKLayer::load() {
                #endif
                texLogo = FZTexture::createFromVitaTexture(vita2d_load_PNG_buffer(&_binary_icon0_t_png_start));
        #elif defined(MAC)
-               genLogo = FZTexture::createFromSOIL("image.png");
+               //genLogo = FZTexture::createFromSOIL("image.png");
                texLogo = FZTexture::createFromSOIL("sce_sys/icon0_t.png");
        #elif defined(PSP)
                // if (!fontBig){
diff --git a/src/bklogo.cpp b/src/bklogo.cpp
index 85e3784..737f278 100644
--- a/src/bklogo.cpp
+++ b/src/bklogo.cpp
@@ -86,8 +86,8 @@ void BKLogo::render() {
     FZScreen::drawText(255, 527, RGBA8(255,255,255,255), 1.0f, "Press Start");
     
   #else
-    genLogo->bindForDisplay();
-    drawImage(0, 0, FZ_SCREEN_WIDTH, FZ_SCREEN_HEIGHT, 0, 0);
+    //genLogo->bindForDisplay();
+    //drawImage(0, 0, FZ_SCREEN_WIDTH, FZ_SCREEN_HEIGHT, 0, 0);
     texLogo->bindForDisplay();
     drawImage(76, 360, 128, 128, 0, 0);
   #endif
diff --git a/src/graphics/fzscreenglfw.cpp b/src/graphics/fzscreenglfw.cpp
index 423f4d2..b65e965 100644
--- a/src/graphics/fzscreenglfw.cpp
+++ b/src/graphics/fzscreenglfw.cpp
@@ -501,7 +501,7 @@ struct CompareDirent {
     }
 };
 
-int FZScreen::dirContents(const char* path, char* spath, vector<FZDirent>& a) {
+int FZScreen::dirContents(const char* path, vector<FZDirent>& a) {
 }
 
 int FZScreen::getSuspendSerial() {

@ebraminio
Copy link
Contributor

Faced some issues on harfbuzz but asked for help from harfbuzz community on its ML.

@pathway27
Copy link
Owner Author

pathway27 commented Jun 13, 2017

Hey,

Wow, thanks, would love help for the harbuzz issue!

Are you building for vita or mac?
This ld: symbol(s) not found for architecture x86_64 suggests mac?

I haven't updated the mac makefile or instructions. Currently only the vita build works.

Let me fix these issues and such while we wait for the harfbuzz resolution.

@ebraminio
Copy link
Contributor

ebraminio commented Jun 13, 2017

Are you building for vita or mac? [..] Currently only the vita build works.

macOS, so please fix it if you have access to mac and is possible :)

Wow, thanks, would love help for the harbuzz issue!

Thank you! I guess my part is just done :) Please try this if is working there:

libharfbuzz.a.zip

I am also trying to merge the fix to harfbuzz upstream and vitasdk packages list but you can have an early look to the fix (which even with these changes, harfbuzz CI is OK so I can say the fix is in good shape I believe)

Steps to create the library:

  1. vitasdk.org installation, obviously
  2. brew install ragel cmake (more on build dependencies)
  3. git clone https://github.com/behdad/harfbuzz
  4. cd harfbuzz && mkdir build && cd build
  5. cmake .. -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake
  6. make

You will find "libharfbuzz.a" on build folder.

@ebraminio
Copy link
Contributor

ebraminio commented Jun 13, 2017

Interestingly the person who reported the issue on harfbuzz bug tracker, here, is also developing a pdf reader for TI-Nspire, a calculator, https://github.com/Legimet/nPDF I guess there would be things can be learnt from that project here.

@pathway27
Copy link
Owner Author

Thanks so much ^.^

I'll give compiling harfbuzz a go and try to see how nPDF is done.

@ebraminio
Copy link
Contributor

Now vitasdk itself has harfbuzz vitasdk/packages#28 also :)

@pathway27
Copy link
Owner Author

Awesome!

@pathway27
Copy link
Owner Author

Hi @ebraminio, looks like the harfbuzz that is in the mupdf repo is closer to version 1.3.2 with some custom patches (commit 9fda4a5f).

I got it to compile with the changes I made thanks to what I saw in your patches.

I was wondering if these changes are ok?

@ebraminio
Copy link
Contributor

ebraminio commented Jan 19, 2018

Changes are OK, thank you. Where are the custom patches, couldn't they applied to latest version? And feel free just to update harfbuzz there, it is guaranteed harfbuzz will have no ABI/API breakage and use of harfbuzz on mupdf is just on a corner case anyway (and to be honest there are issues with it, harfbuzz itself is not enough for providing a capability like editing, segmentation and bidi should also be done which is not on mupdf it seems). Since this issue, harfbuzz is on psvita package manager https://github.com/vitasdk/packages/blob/master/harfbuzz/VITABUILD , and we have a CI bot on harfbuzz itself that checks build-ability of the project on psvita/arm-none-eabI https://github.com/harfbuzz/harfbuzz/blob/master/.circleci/config.yml#L82-L90 because since my first fix, I had to patch it again due to some changes and I didn't want that again :)

@pathway27
Copy link
Owner Author

Not sure about the custom patches, but I got it working now.
Thanks for you help!

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

2 participants