M
M
Muhammad2015-06-07 13:12:50
Android
Muhammad, 2015-06-07 13:12:50

Pagination of content?

Hello, I am making an application - an e-book reader. The book will be in its own format, but that doesn't matter. The book can contain images and text. The application needs to be able to enlarge the text, so I don't know how much content will fit on the page. How can I find out the number of pages required to accommodate text and pictures?
PS If the question is not clear, please see the Amazon Kindle application. There, when you increase the text, the program immediately recalculates the number of pages.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
maaGames, 2015-06-07
@maaGames

Take it and be honest. There is a string of 100 characters of various heights and widths. You calculate how many characters fit into the string, you transfer the rest. And add height. And so on until the letters and pictures run out. Long, dreary, but it will work. GOF on such an example explained some kind of OOP pattern, I already forgot which one. There, each letter is in the form of an object with them ... If word wrapping is not necessary, then it is better to consider it not at the level of individual letters, but at the level of words - there will be fewer objects.
But I have another question: why change the number of pages? So you read and remember that you stopped at page 113. Then I increased the font and you can no longer find where you read it. Maybe just change the "height" of the pages? This is not printing, nothing prevents you from making the pages longer. It will be much more efficient in terms of work - the data can be divided into pages and you do not have to load the entire book, just to count the pages.

S
sim3x, 2015-06-07
@sim3x

In fact, after changing the font size, you need to translate the entire book, taking into account the fact that it is not clear what to do if the user is in the middle of the book and is currently reading two pages, but he needs to show one and vice versa

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question