Exemple #1
0
    // Create a book from the filename to the ebook.
    private IEnumerator loadBookInternal(string bookFileName, BookPropertySet props)
    {
        setInformation("Loading");
        yield return(null);

        initializeTextures();

        setInformation("Loading.");
        yield return(null);

        // Try to load the book in a separate thread.
        loadingName = bookFileName;
        rx          = directRenderTexture.width;
        ry          = directRenderTexture.height;
        loading     = true;
        Thread t = new Thread(new ThreadStart(doLoading));

        t.Start();
        while (loading)
        {
            yield return(new WaitForSeconds(0.1f));

            print("Waiting");
        }

        setInformation("Loading..");
        yield return(null);

        // Retrieve the title and author settings.
        string title  = Marshal.PtrToStringAnsi(bookEngine.BEIGetTitle(bookHandle));;
        string author = Marshal.PtrToStringAnsi(bookEngine.BEIGetAuthors(bookHandle));

        Debug.Log("Author " + author + " title: " + title);

        // Retrieve the cover image. This involves render operations so
        // cannot take place in its own thread.
        retrieveCoverMaterial(frontCover);

        setInformation("Loading...");
        yield return(null);

        GetComponent <BookProperties> ().props = props;
        //bookProperties = props;
        // Change page to force initial page drawing.
        currentPage = props.currentPage;
//    changePage (currentPage);
//    pageTurnComplete ();

        fontSize = props.fontSize;
        yield return(updateFont());

        fontSize = bookEngine.BEIGetFontSize(bookHandle);

        bookLoaded = true;

        setInformation("");

        stateChanged();
    }
Exemple #2
0
    int BookEngineInterface.BEIGetFontSize(IntPtr handle)
    {
        int result = 0;

        switch (format)
        {
        case BookFormat.coolreader:
            result = cri.BEIGetFontSize(handle);
            break;

        case BookFormat.poppler:
            result = pop.BEIGetFontSize(handle);
            break;
        }
        return(result);
    }