/*--------------------------------------------------------------------------
  Project:  Manual 2D Library - m2d
  File:     lyt_drawInfo.cpp

  Copyright (C)2007-2009 Nintendo. All Rights Reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law. They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

  $Revision: 1.7 $
 *-------------------------------------------------------------------------*/

#include <nitro.h>
#include <nnsys/misc.h>
#include <nnsys/g2d/g2d_Font.h>
#include <ntmv/m2d/drawInfo.h>
#include <cstring>

namespace ntmv
{
namespace m2d
{

DrawInfo::DrawInfo()
:   mFrameBuf(0),
    mFonts(0),
    mpPage(0)
{
    std::memset(&mFlag, 0, sizeof(mFlag));
}

/*---------------------------------------------------------------------------*
  Name:         DrawInfo::GetFont

  Description:  Gets the font object from the font size.

  Arguments:    size: Font height

  Returns:      Returns the font object. 
 *---------------------------------------------------------------------------*/
const NNSG2dFont*
DrawInfo::GetFont(u16 size) const
{
    // The heights of the medium size Japanese, North American, European, Korean, and Chinese fonts are the same, so use this value to determine the large, medium, and small font sizes
    // 
    // 
    const int midFontH = 16;

    int idx = FONTSIZE_12;  // Medium size

    if (size < midFontH)
    {
        idx = FONTSIZE_10;  // Small size 
    }
    else if (size > midFontH)
    {
        idx = FONTSIZE_16;  // Large size 
    }

    return mFonts[idx];
}


}   // namespace m2d
}   // namespace ntmv
