What happens if I have used 2 different fonts in my content for mobi/epub and user changes the font in the devise,like in kindle? does both the fonts change? if yes, is there any way to protect the fonts from changing(apart from converting to images)?
First, though you can embed fonts in an epub/mobi file, there is no guarantee that the reading system will display the font correctly. I used an embedded font on my last ebook, and it did not render correctly on all devices (on kindle for example, it rendered on most systems, but not all). My guess is that more recent reading systems will support embedded fonts better, but you should always assume that a backup font could be used.
Most reading systems offer a limited amount of fonts and allow the reader to override the publisher's specified fonts. In some reading systems, there is an option for the system to use publisher settings, but there is no guarantee that the reader will have checked this setting.
My strategy has been to not specify fonts for the body text, but specify/embed fonts only when the element needs to be differentiated from the rest of the text. (Maybe it's a blockquote, a heading or a preface or title).
I haven't tested ebooks in a while, but you might find it surprising to know that certain fonts don't display properly when embedded on some reading systems while other fonts do. You can only determine this by testing on several different reading systems.
When the user changes the font on the reading system, usually it's only for body and paragraphs; sometimes it's for paragraphs and headings. It depends on the reading system. Some reading systems (like Adobe Digital Editions on android) embed all the fonts and don't give readers any choices, while other reading systems let you choose from 20 or 30 different fonts. This is insanity, don't you agree?
As a publisher, it drives me crazy that a reader would switch fonts because of a personal preference. I predict that eventually readers won't have the option to select font family -- only font size --, but I admit I really don't know what will be the future.
There isn't much you can do, if the device allows to change the fonts and the user is willing to use that option, he will do it.
If you use different fonts not just for aestethics, but with a functional purpose (i.e. to display code with a fixed width font, or to differentiate quotes from default paragraphs, and so on), your best option, IMHO, is to insert a disclaimer where you explain this to the end user.
"As a publisher, it drives me crazy that a reader would switch fonts because of a personal preference" If they prefer it in another style I'm not sure why that would bother you. It would bother me more if my customer found my work easier to digest in another font but couldn't change it. Why on earth would you make your book harder to read?
You can't generalise, because there are many e-book reader programs, and all of them work differently.
In the Calibre e-book reader program, for instance, the user can design a personal stylesheet, which is an optional choice by the user. That is a user-customisable stylesheet which, if present, will over-ride all the css settings embedded in the e-book (in so far as they conflict with the stylesheet).
The reader program is designed to be able to over-ride the fonts specified in the ebook file in this manner, in case the user doesn't have those fonts on his device.
There is an option open to the ebook publisher : embed the fonts in the file. Then the user doesn't have to provide for not having them. But it does make the e-book file much bigger, which can be very inconvenient for the user. Many devices are slow, and under-powered.
The future gives all the advantage to the user. The user-groups will deliberately ensure that this is so. This is called freedom of choice.
What the publisher can do is provide the most user-friendly experience possible. This includes NOT issuing huge files, stuffed with obscure fonts that slow down the user's ability to scroll through the e-book.
Proprietory fonts are not welcome if they have a negative impact on the end-user. Learn to do things in a user friendly way, so that the user has no motivation to override the e-book's default settings.
Real books, made of paper, generally use only a small number of industry-standard fontfaces. This should also be the practice with e-books.
Develop industry standards for e-book files, and for e-reader devices, to improve compatibility between the books and the reader program.